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 Chris <sh...@yahoo.com> on 2010/09/17 21:17:02 UTC

Loggers share an Appender instance?

When you configure the root logger to use an Appender, all other named 
loggers that you create share that Appender instance. The system does 
not create a new Appender for each child logger.

This makes it impossible to create an Appender that maintains state for 
a given child logger. (And it's no mystery now why log4j has 
synchronization problems.)

Let's say you want to log to a file, with a different file for each 
logger, and have the filename depend on the logger name. It's impossible 
to do unless you configure, in advance, every possible logger name with 
its own Appender. If you use any libraries that create their own loggers 
without telling you, you're out of luck.

Somebody please tell me there's a switch somewhere that will tell the 
default logger factory to create a new Appender instance for each child 
logger.


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


Re: Loggers share an Appender instance?

Posted by "Mohan.Radhakrishnan" <mo...@fss.co.in>.
Hi Shef,
               Looks like your question is like mine (
http://old.nabble.com/Multiple-log-files%2C-multiple-logger-names-and-the-same-appender-td28024737.html
).

My appender is only one by I want a logger specific file. The recommendation
is a custom appender.

Thanks,
Mohan
-- 
View this message in context: http://old.nabble.com/Loggers-share-an-Appender-instance--tp29741792p29969699.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