how to use differnt logfiles for different modules in a project in log4j
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sangeetha_Rao
Posted On:   Friday, July 29, 2005 12:19 AM

In log4j how and where do u specify that the messages in my x component must be logged in xlog file and the messages in the y component must be logged in the ylog file. I am able to unsderstand the basics of log4j but I am having difficulty in understanding the big picture !! Plz reply ASAP

Re: how to use differnt logfiles for different modules in a project in log4j

Posted By:   seetha_lakshmi  
Posted On:   Friday, July 29, 2005 06:25 AM

hi,
i assume you are using a property file for configuring log4j.
(e.g)if ur project named ABC has two modules A and B which are in two different folders you can configure your property file like below




log4j.category..A=DEBUG,ALogFileAppender

log4j.appender.ALogFileAppender=org.apache.log4j.DailyRollingFileAppender

log4j.appender.ALogFileAppender.File= (e.g) c:/A.log

log4j.appender.ALogFileAppender.Append=true

log4j.appender.ALogFileAppender.ImmediateFlush=true

log4j.appender.ALogFileAppender.DatePattern='.'yyyy-MM-dd-a

log4j.appender.ALogFileAppender.layout=org.apache.log4j.PatternLayout

log4j.appender.ALogFileAppender.layout.ConversionPattern=[%d{dd MMM yyyy HH:mm:ss}][%c{2}:%L] %p %m%n







log4j.category..B=DEBUG,BLogFileAppender

log4j.appender.BLogFileAppender=org.apache.log4j.DailyRollingFileAppender

log4j.appender.BLogFileAppender.File= (e.g) c:/B.log

log4j.appender.BLogFileAppender.Append=true

log4j.appender.BLogFileAppender.ImmediateFlush=true

log4j.appender.BLogFileAppender.DatePattern='.'yyyy-MM-dd-a
log4j.appender.BLogFileAppender.layout=org.apache.log4j.PatternLayout

log4j.appender.BLogFileAppender.layout.ConversionPattern=[%d{dd MMM yyyy HH:mm:ss}][%c{2}:%L] %p %m%n
About | Sitemap | Contact