You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Camuto, Matthew" <ma...@redsealsys.com> on 2005/05/13 23:43:41 UTC

help migrating to a custom LoggingFactory

Hi-

 

I am migrating to my own extensions (inherited classes) for Loggers in
log4j but I also want to now add a new factory to my code such that:

 

Logger.getLogger(String name) 

 

Will return a new custom type Logger (MYLogger for example) but I would
like this work without changing all the current source code at this
time.

 

For example I would like

 

MYLogger ml = (MYLogger) Logger.getLogger(String name);

 

To be essentially the same as

 

MYLogger ml = (MYLogger) MYLogger.getLogger(String name); /// Custom
implementation

 

Upon reading the source code I thought I could do this by changing the
LoggingFactory in the log4j.properties file as following:

 

log4j.loggerFactory=org.matt.tests.RSLog.MYLoggerFactory

log4j.debug=true

 

log4j.rootLogger=DEBUG, A1,INT,EXT

log4j.debug=true

 

log4j.logger.internal=DEBUG,INT

log4j.additivity.internal=false

 

Where MyLoggerFactory is a custom logger factory I created. From looking
at the source code it seemed that I should now always create 'MYLogger'
instances from within even Logger.getLogger (String name) but this does
not seem to be the case.

 

Bascially I am trying to slow migrate to my own custom logger but would
like to NOT interfere with other developers if they do not need the new
functionality of my new logger just yet.

 

Any help would be great.

 

matt