Closed SVoyt closed 5 years ago
Hello Sergey, it seems you don't have log4j's jar in your jasperreports lib directory.
Please check it out, and if not present, add it.
jasperreports-6.1.0-project.tar.gz comes with log4j-1.2.15.jar and was working.
Hope it helps.
Hi agmoyano, thanks for the quick response. The problem is that jasper > 6.4.0 using log4j 2.8.2 version, there is a different structure of libs, instead of one lib (log4j-1.2.15.jar) there are log4j-api lib, log4j-core lib etc.
Yes, you are right.. it seems org.apache.log4j.ConsoleAppender now it's called org.apache.logging.log4j.core.appender.ConsoleAppender. It seems log4j's configuration should be done through a ConfigurationBuilder as described in:
https://logging.apache.org/log4j/2.x/manual/customconfig.html
I've found some examples here on how to use it:
If you are willing to make a PR I'll check it out, and merge it if it's ok
Thanks
Thanks, i'll try
There is an error when using jasper 6.4.3 and above. Bug is in debug function code:
debug: ['loadJars', function(cb) { if(!options.debug) options.debug = 'off'; var levels = ['ALL', 'TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL', 'OFF']; if(levels.indexOf((options.debug+'').toUpperCase()) == -1) options.debug = 'DEBUG'; var appender = java.newInstanceSync('org.apache.log4j.ConsoleAppender'); var pattern = java.newInstanceSync('org.apache.log4j.PatternLayout', "%d [%p|%c|%C{1}] %m%n"); appender.setLayout(pattern); appender.setThreshold(java.getStaticFieldValue("org.apache.log4j.Level", (options.debug+'').toUpperCase())); appender.activateOptions(); var root = java.callStaticMethodSync("org.apache.log4j.Logger", "getRootLogger"); root.addAppender(appender); cb(); }],
var appender = java.newInstanceSync('org.apache.log4j.ConsoleAppender'); ^
Error: Could not create class org.apache.log4j.ConsoleAppender java.lang.NoClassDefFoundError: org/apache/log4j/ConsoleAppender