logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yaakov Chaikin" <yaakov.chai...@gmail.com>
Subject Name of the class showing up in logs
Date Mon, 07 Jan 2008 04:20:47 GMT
Hi,

I am using log4j 1.2.14.

I have a class where I've declared the logger as follows:
protected Logger logger = Logger.getLogger(SomeClass.class);

In one of the methods in that class, I pass the 'logger' to a static
method of another class, like this:
SomeOtherClass.doMethod(logger);

The output that I get is showing that the logging is coming from
SomeOtherClass instead of from SomeClass, which is strange to me. I've
been using log4j for a long time, but it's possible that I've never
noticed this before.

Is there a way to tell log4j to use the originally initialized class
instead of the one it's executing from? I am not even 100% how it
knows which class it's in. I was assuming that the logging is always
done from the class that it was initialized with. Am I configuring
something wrong?

My appender is configured as follows:

    <appender name="testing-stdout" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern"
                value="***-> %-5p %C{1} - %m%n"/>
        </layout>
    </appender>


Any help would be appreciated.

Thanks,
Yaakov.

---------------------------------------------------------------------
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