Logging a specific package in log4j programmatically

Posted by VinTem on Stack Overflow See other posts from Stack Overflow or by VinTem
Published on 2010-05-13T17:35:52Z Indexed on 2010/05/13 20:24 UTC
Read the original article Hit count: 314

Filed under:
|

Hi there, here is the thing, I have to deploy a web app and the the log4j.properties file is created by the client so I dont have control over it. Their properties file is like this:

log4j.rootCategory= FILE

!-----------FILE--------------! log4j.category.FILE=DEBUG log4j.appender.FILE=org.apache.log4j.RollingFileAppender log4j.appender.FILE.File=${catalina.base}/logs/rcweb.log log4j.appender.FILE.MaxFileSize=1024KB log4j.appender.FILE.MaxBackupIndex=10 log4j.appender.FILE.layout=org.apache.log4j.PatternLayout log4j.appender.FILE.layout.ConversionPattern=%-2d{dd/MM/yyyy HH:mm:ss} [%t] %5p %c:%L - %m%n

And in my classes I do something like this: private static final Logger LOG = Logger.getLogger(MaterialController.class); LOG.info("my log");

But the log file has never been created.

I did the test and changed the log4j.properties file and deployed in my computer adding the following line: log4j.logger.br.com.golive.requisicaoCompras=DEBUG

This works, but I cant use the file like this.

Is there any ideas?

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about log4j