[logback-user] How to log FROM an appender?

Steve Cohen scohen at javactivity.org
Mon Nov 14 23:00:12 CET 2011


On 11/12/2011 04:14 PM, Steve Cohen wrote:
> We have a custom appender that may itself need to issue logging
> statements. But placing a logger in such a class causes various
> exceptions on initialization and loading. So we are resorting to
> System.out.println for lack of a better solution.
>
> I suppose there must be a better way.
> What would that be?
>
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
>
A technique that seems to work is to NOT declare a logger in the 
Appender class that you want to use one from, but instead create a 
static logger instance somewhere that is accessible through static 
methods.  That way the logger does not need to be created at the time of 
appender instantiation.


More information about the Logback-user mailing list