logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bender Heri <hben...@ergonomics.ch>
Subject RE: Extending Logger
Date Tue, 02 Nov 2010 13:09:55 GMT
If I understand you correctly:
You have many instances of your CustomLogger (as many as you want different log files), each
wrapping a separate instance of Logger. The name of the file is configured in a file (I assume
a pairing of logger names and file names?).
My suggestion: Do not extend Logger, but instantiate the Loggers programmatically and supply
it with a FileAppender which is also instantiatted programmatically (based on your config
file).
Heri
BTW: The extending of Logger is discouraged not because it would not work (well, some particular
features wouldn't work anymore), but because one cannot imagine any reason why this would
be necessary. The work of Log4j is done within the Appenders, Filters, Layouts, etc. The Logger
class only provides an entry point for log statements in code.

> -----Original Message-----
> From: Mohan.Radhakrishnan [mailto:mohanr@fss.co.in]
> Sent: Tuesday, November 02, 2010 1:26 PM
> To: log4j-user@logging.apache.org
> Subject: RE: Extending Logger
> 
> 
> I wanted to associate the logger file with each Logger instead of the
> Appender. I have a setFile/getFile in the Logger that I plan to call using
> my custom Appender so that the log message is written to the file associated
> with the Logger.
> 
> Reasons :
> 
> 1. We have two many appender sections in the XML because there are too many
> log files.
> 2. I want to use my custom logger/appender and another xml file - not
> log4j.xml - to associate a logger with a file.
> 
> I am trying to parse and read the file name from my custom XML file and set
> it in my custom logger that log4j's repository has.
> --
> View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30113301.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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