开发者

How can I disable these log messages in JasperReports?

I am getting TONS of these messages when generating a PDF with Jasper now:

INFO: Overriding bean definition for bean 'stackedAreaType': replacing [Generic bean: class [org.springframework.beans.factory.config.FieldRetrievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.beans.factory.config.FieldRetrievingFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] Sep 26, 2011 10:42:57 AM org.springframework.beans.factory.support.Defa开发者_JAVA技巧ultListableBeanFactory registerBeanDefinition

Obviously I need to set the log level somewhere, just not sure of the command. Any help is appreciated! I am not a Java expert, I use JR embedded in a Ruby app to give my customers nice PDFs.


I don't know about Jasper specifically but this is the generic approach. You need to change the log4j root log level.

Look for a file log4j.properties. Find a line that looks like:

log4j.rootCategory=INFO

Replace INFO for WARN. Restart your server process.


I had the same problem, I run a java program from the commandline, that program outputs a pdf to stdout where PHP redirects it to browser, and some library(spring.jar) was outputting lots of INFO that crippled the pdf output, I tried running the java commandline with java -Dlog4j.rootCategory=WARN but for some reason it didn't work, so I finally solved it by setting the logging level programatically:

import org.apache.log4j.Logger;
import org.apache.log4j.Level;

Logger logger = Logger.getRootLogger();
logger.setLevel(Level.WARN);

Make sure you have log4j-1.2.16.jar in your CLASSPATH.


I was able to do this using both of the answers listed here. I created a log4j.properties file and added this in it:

log4j.rootCategory=WARN

But I also had to add log4j in my classpath.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜