You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Allistair Crossley <Al...@QAS.com> on 2003/11/20 12:36:53 UTC

I need my web application to output to different log files

Hi All,

I am struggling with understanding how I may setup my webapp to output to multiple logs. At the moment I have setup one log. My log4j.properties is in my WEB-INF/classes folder and contains;

log4j.rootLogger=debug, stdout, R

#### Standard Output

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern==%d [%p] %c %x %m%n

#### R (Root Application)

log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=appA.log
log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern==%d [%p] %c %x %m%n

In my classes for my webapp I always use

static Logger logger = Logger.getLogger("com.mycompany.appa.AClass");

Now, for the set of classes in this package I want the logging output only to go to a new log called appB.log.

Could anyone suggest how I do this? Do I need to add a new appender to my log4j? Do I then override the File property of that new appender with the classes package somehow?

Thanks!


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Developers of QuickAddress Software
<a href="http://www.qas.com">www.qas.com</a>
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org