logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <remko.po...@gmail.com>
Subject Re: log4j2 how to write a wrapper that passes the class name of my own
Date Sun, 02 Nov 2014 11:44:54 GMT
Both AbstractLogger and ExtendedLogger are in the log4j-api module and I
don't expect this to change in the future.
There are no guarantees in life (insert joke about death, taxes, and Aubrey
de Grey here) but I would not worry about it too much.
:-) Remko

On Sun, Nov 2, 2014 at 8:22 PM, Alexander Lehmann <alexlehm@gmail.com>
wrote:

> I see that the generated class casts the Logger to AbstractLogger to get
> the ExtendedLogger, is this always the case? I know that logger classes
> should extended AbstractLogger and not just implement Logger, but how can
> we be sure?
>
> On Mon, Oct 27, 2014 at 12:49 AM, Remko Popma <remko.popma@gmail.com>
> wrote:
>
> > Alexander,
> >
> > I recommend that you use ExtendedLoggerWrapper (log4j-api, spi package).
> >
> > The quickest way to get started may be to take a look at the code
> > generated by the Generate tool for custom log levels:
> > http://logging.apache.org/log4j/2.0/manual/customloglevels.html#CodeGen
> >
> > Sent from my iPhone
> >
> > > On 2014/10/27, at 7:32, Alexander Lehmann <alexlehm@gmail.com> wrote:
> > >
> > > I am trying to write a log wrapper for log4j2 for a application server
> > > that uses it's own logger with a wrapper for log4j 1.2, slf4j or JUL.
> > >
> > > To be able to log method names and line numbers, the log4j 1.2 wrapper
> > > currently passes the class name of the Logger to the log() method to
> > > make it possible to log the correct method, otherwise only the log
> > > method of the wrapper class is logged.
> > > I am not able to figure out how to do that with log4j2 where the log
> > > methods do not have a parameter for the class name.
> > >
> > > (On a side-note, when I use log2j 1.2 and the log4j 1.2-api for log4j
> > > 2.x, logging method names works, so I'm probably missing something
> > obvious)
> > >
> > > Thanks for your help
> > > bye, Alexander
> > >
> > > --
> > > Alexander Lehmann <alexlehm@gmail.com>
> > > http://about.me/alexlehm
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
>
> --
> Alexander Lehmann <alexlehm@gmail.com>
> http://about.me/alexlehm
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message