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 <[email protected]> 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 <[email protected]> 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 <[email protected]>
> > http://about.me/alexlehm
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Alexander Lehmann <[email protected]>
http://about.me/alexlehm

Reply via email to