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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to