logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan Fuentes <juanmarianofuen...@gmail.com>
Subject Logger Wrapper + Trace API = Issues
Date Sat, 10 Sep 2016 18:57:46 GMT
Dear all,

After spending half a day on this I have decide to try luck on the official mailing list,
hopefully some dev can throw some light over this.

I’m trying to use a wrapper over a Logger object to restrict the methods of the API to the
ones on my interface, for example:

class Log4JLogger implements com.opencms.core.logging.Logger {

    private Logger logger;

    public Log4JLogger(Logger logger) {
        this.logger = logger;

    public void traceEntry(String message, Object... args) {
        this.logger.traceEntry(message, args);
If I combine this with a pattern that includes the line and the method name, for example:
<PatternLayout pattern="%d{yyy-MM-dd HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>

I get as result the line and method name on the wrapper, what makes sense, but is not what
I want to. I want the ones from the class that calls the wrapper.

Any way to configure/specify this in any way?

I would be also happy if I can just extend a Logger and implement my interface on it, but
what logger should I extend? How can I create an instance of this custom logger afterwards?

Thanks in advance,
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message