Avoid messages to be logged when the properties are commented in log4j.properties !
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sarika_Inamdar
Posted On:   Thursday, February 12, 2004 02:43 AM

Hi, We have the following configuration in log4j.properties : log4j.rootCategory=DEBUG, das log4j.appender.das=org.apache.log4j.RollingFileAppender log4j.appender.das.File=logs/das.log log4j.appender.das.MaxFileSize=1000KB log4j.appender.das.MaxBackupIndex=1 log4j.appender.das.layout=org.apache.log4j.PatternLayout log4j.appender.das.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss zz}] %p %c -  %m%n # Performance debugging use #log4j.category.perf=INFO, perfLog #log4j.additivity.perf=false #log4j.appender.perfLog=org.apache.log4j.RollingFileAppender    More>>

Hi,



We have the following configuration in log4j.properties :



log4j.rootCategory=DEBUG, das

log4j.appender.das=org.apache.log4j.RollingFileAppender

log4j.appender.das.File=logs/das.log

log4j.appender.das.MaxFileSize=1000KB

log4j.appender.das.MaxBackupIndex=1

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

log4j.appender.das.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss
zz}] %p %c -

 %m%n



# Performance debugging use

#log4j.category.perf=INFO, perfLog

#log4j.additivity.perf=false

#log4j.appender.perfLog=org.apache.log4j.RollingFileAppender

#log4j.appender.perfLog.File=logs/perf.log

#log4j.appender.perfLog.MaxFileSize=1000KB

#log4j.appender.perfLog.MaxBackupIndex=1

#log4j.appender.perfLog.layout=org.apache.log4j.PatternLayout

#log4j.appender.perfLog.layout.ConversionPattern=%r %c - %m%n



The perfLog is uncommented only when the application is undergoin
performance testing,  The problem is when the performance debug
properties are

commented, the log messages pertaining to this is seen in the root log
which is das.log.



Is there a way we can control this ? Meaning, when the above properties
are commented , the log messages should not be displayed in the main
ROOT log.



The following is the way, the loggers are instantiated in the java code
:



 static Category log = Category.getInstance(Schedule.class);

 static Category perfLog =
Category.getInstance("perf.core.Schedule");



perfLog.debug("interval wakeup");



We want the above message to be printed only when the performance
properties are uncommented . Is there a way to acheieve this ?

Any help on this is appreciated.



Thanks in Advance,

Sarika


   <<Less

Re: Avoid messages to be logged when the properties are commented in log4j.properties !

Posted By:   Srini_Admala  
Posted On:   Wednesday, March 31, 2004 11:03 AM

das is configured as the default Appender at the root level. All messages would be logged in das for all enabled child appenders.

You can disable propagation of log messages to higher levels using the following line in your log4j.properties.


log4j.additivity.perf=FALSE


Srini

Re: Avoid messages to be logged when the properties are commented in log4j.properties !

Posted By:   ravi_sambandam  
Posted On:   Monday, February 16, 2004 10:41 PM

as for as i know when ever u try to get a logger which is not defined in the property file , it will try to attach the root logger ,in ur case it is das.Hence what ever u log using perfLog will be logged in the file das.log


ravi.s
About | Sitemap | Contact