logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: Submission StreamAdapter
Date Sat, 13 Apr 2002 08:35:11 GMT

Hi Niclas,

This is a pretty neat contribution. Actually Jim Moore made a similar one
some time ago (see contribs/JimMoore).

The only serious issue with such adapters coccurs when they redirect System.out
and System.err. If log4j encounters an error it will use LogLog which uses
System.out or System.err which in turn will generate a new log request, which
might generate another call to System.out, and so on, causing an infinite loop.

One solution to this problem is to use guards to protect against infinite 
If you enter the same method when the guard is "on" then you ignore the
request preventing infinite loops.

On a related register, let me mention that internal log4j messages can
only appear on the console. As of this writing, the internal debug
messages cannot be redirected to output devices other than the
console. The limitation stems from the fact that log4j cannot use
itself to perform its own logging. This can be considered an
intriguing architectural flaw which we intend to address in future
versions of log4j using guard-type techniques that I just mentioned.
Fortunately enough, it seems that this limitation has not had any
(or much) practical impact.

Oh, I almost forgot. Although the beer license is very cool, we cannot
commit to our CVS repository anything but code that is licensed under
the Apache Software License. Would you care to change the license
so that I can commit it? TIA, Ceki

At 14:27 13.04.2002 +0800, Niclas Hedhman wrote:

>I was in the need to redirect the RMI logging output to log4j and created a
>small adapter that handles that, which is an OutputStream that transact to
>the Log4J loggers upon reception of new line character, flush or close.
>         StreamAdapter sa = new StreamAdapter( logger , level );
>         RemoteServer.setLog( sa );
>This is released as BeerWare;
>"This license grant you to use the software in any way you want, no
>limitations, provided;
>a) You hold the author unresponsible for any and all effects.
>b) Drink a beer to salute the author.
>To unsubscribe, e-mail:   <mailto:log4j-dev-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:log4j-dev-help@jakarta.apache.org>


To unsubscribe, e-mail:   <mailto:log4j-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-dev-help@jakarta.apache.org>

View raw message