logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aneez Backer" <ane...@pramati.com>
Subject Re: Can custom appender override the log4j.xml configuration
Date Thu, 21 Aug 2008 12:15:13 GMT

> If you don't want log4j to avoid the default initialization procedure you 
> can set the log4j.defaultInitOverrride system property to anything other 
> than "false".

How does log4j interpret defaultInitOverride?? Does any value other than 
'false' imply true ?? Does 'null' also imply true ??

Thanks
Aneez


----- Original Message ----- 
From: "Michael Erskine" <michael.erskine@ketech.com>
To: "Log4J Users List" <log4j-user@logging.apache.org>
Sent: Tuesday, August 19, 2008 1:49 PM
Subject: RE: Can custom appender override the log4j.xml configuration


Hi Aneez,

> I initialise the Logger instance as follows:
>     Logger customLogger = Logger.getLogger("myCustomLogger");
>     / / remove all appenders associated with customLogger
>     customLogger.removeAllAppenders();
>     // add JDBCAppenderService to customLogger
>     customLogger .addAppender(new JDBCAppenderService(ds));  //ds is the
> datasource name

How about removing all appenders from the root logger? Or is that not what 
you want to achieve? Remember that the loggers are hierarchical.

> I want customLogger to remained unaffected by the settings in the
> log4j.xml
> file. So, if the logging level in log4j.xml is set to OFF, I still want
> the
> JDBC appneder to work i.e log data in the database.

You can programmatically set the logging level of your appender.

> Please let me know if there any way to achieve this ?? Or does the
> log4j.xml
> configuration overrides the settings in the class files ??

If you don't want log4j to avoid the default initialization procedure you 
can set the log4j.defaultInitOverrride system property to anything other 
than "false".

Regards,
Michael Erskine.


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


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


Mime
View raw message