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, 26 Oct 2014 23:49:16 GMT
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


Mime
View raw message