log4j - display logger.debug(...) from one class to only a specific log file
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sam_G
Posted On:   Thursday, February 16, 2012 02:50 PM

I want logger.debug statement from one class (org.myorg.MyClass) to go to only one log file (logY.log, which is appender A1) and not to show in logX.log. With configuration below, logger.debug from org.myorg.MyClass is now shoing in both logX.log and logY.log. What is the least amount of change (this is maintenance code) that can be done in the following log4j.properties to show logger.debug("aaa") from org.myorg.MyClass only in logY.log (appender A1) and not show in logX.log? Following is log4j.properties: log4j.rootLogger = DEBUG, stdout log4j.appender.stdout=org.apache.log4j.RollingFileAppender log4j.appender.stdout.File=${pathVariable}/logX.log    More>>

I want logger.debug statement from one class (org.myorg.MyClass) to go to only one log file (logY.log, which is appender A1) and not to show in logX.log. With configuration below, logger.debug from org.myorg.MyClass is now shoing in both logX.log and logY.log.


What is the least amount of change (this is maintenance code) that can be done in the following log4j.properties to show logger.debug("aaa") from org.myorg.MyClass only in logY.log (appender A1) and not show in logX.log?


Following is log4j.properties:



log4j.rootLogger = DEBUG, stdout


log4j.appender.stdout=org.apache.log4j.RollingFileAppender


log4j.appender.stdout.File=${pathVariable}/logX.log


...
...


log4j.logger.org.myorg.MyClass=DEBUG, A1


log4j.appender.A1=org.apache.log4j.RollingFileAppender


log4j.appender.A1.File= ${pathVariable}/logY.log


...
...

   <<Less
About | Sitemap | Contact