Are you sure you are picking up the correct config file? "log4j.xml"
is used in preference to log4j.properties even with Tomcat's
child-first classloading. If log4j.xml is on the classpath in the
default package anywhere in the classpath (server classpath or
misbehaving jars including log4j.xml), then log4j.xml will be used
instead of your own log4j.properties.
BTW, if you are going to wrap the logger, then you should be passing
the FQCN (fully qualified class name) of the wrapper class to Log4j
so that stack traces are printed properly.
Jake
At 08:01 PM 3/12/2007, you wrote:
>my log4j.jar is at the WEB-INF/lib at the war
>log4j.properties at WEB-INF/classes at the war
>
>On 3/12/07, James Stauffer <[EMAIL PROTECTED]> wrote:
>>
>> Where is your log4j.jar. If it is only in a shared location then the
>> configs are shared (basically merged together).
>>
>> On 3/12/07, Andre Prasetya <[EMAIL PROTECTED]> wrote:
>> > Hi All,
>> >
>> > I encounter a strange behaviour. I'm using commons-logging and log4j.
>> this
>> > is what happened.
>> >
>> > i have an application named heart, and a similar aplication named
>> > md-smslogger. both using a similar log4j.properties placed at
>> > WEB-INF/classes.
>> >
>> > weird things happened, heart only logs to stdout (to catalina.out at
>> tomcat
>> > 5.5 or to server.log at glassfish), heart uses spring and some of my
>> libs,
>> > both write logs to file as it should be. but codes at servlets only
>> write to
>> > stdout.
>> >
>> > i m using this class to get the Log
>> > public class Logging {
>> >
>> > /** Creates a new instance of Logging */
>> > public Logging() {
>> > }
>> >
>> > public static Log getLogger(Object caller) {
>> > Log logger = getLogger(caller.getClass());
>> > return logger;
>> > }
>> >
>> > public static Log getLogger(Class clazz) {
>> > Log logger =
>> > (clazz != null) ?
>> > LogFactory.getLog(clazz) :
>> > LogFactory.getLog("Ricochet Log");
>> > return logger;
>> > }
>> > }
>> >
>> > and use it in code like this
>> > Log log = Logging.getLogger(this);
>> > log.info("fetched : " + raw);
>> >
>> >
>> > the log4j properties of heart is as follow :
>> > log4j.rootLogger=INFO,STDOUT,HEARTFILE
>> >
>> > log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
>> > log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
>> > log4j.appender.STDOUT.layout.ConversionPattern=%5p %d{HH:mm:ss} [%t]
>> %c{1} -
>> > %M%n%m%n
>> >
>> > log4j.appender.HEARTFILE.layout=org.apache.log4j.PatternLayout
>> > log4j.appender.HEARTFILE.DatePattern=yyyy-MM-dd
>> > log4j.appender.HEARTFILE.layout.ConversionPattern=%5p %d{HH:mm:ss} [%t]
>> > %c{1} - %M%n%m%n
>> > log4j.appender.HEARTFILE=org.apache.log4j.DailyRollingFileAppender
>> >
>> > log4j.appender.HEARTFILE.File=/opt/gateway/logs/LegacyEngine.log
>> >
>> > log4j.logger.com.mchange=INFO
>> >
>> > help, where have i gone wrong ? I already tried using log4j directly at
>> the
>> > servlet classes but it didn't solve the problem.
>> >
>> > --
>> > -Andre-
>> >
>>
>>
>> --
>> James Stauffer http://www.geocities.com/stauffer_james/
>> Are you good? Take the test at http://www.livingwaters.com/good/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
>--
>-Andre-
>
>People see things the way they are and say "why ?" I see things that never
>were and say "Why not ?"
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]