users@glassfish.java.net

Re: Log4j is not logging

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Wed, 30 Aug 2006 12:18:13 -0700

Jason,

Jason Lee wrote On 08/30/06 06:24,:

>Jan, I can try that, though I'm not relishing giving up XML. :) I have
>run into problems with log4j's XML and validating parsers (for example,
>I can't run my unit tests at the moment for that very reason), but if
>the .properties solves that problem, then I'm all for it. I've attached
>my (cmoplete, but very simple) log4j config. Thanks for the tip.
>
>

I've wrapped your attached log4j.xml in a JAR (after changing
the log file location), placed the JAR in my EAR's lib directory,
and was able to see my servlet's log messages getting logged to
the log file specified in the log4j.xml.

(Looks like the earlier log4j.xml I was using had some problems.)

So I think the only reason why you were unable to see any log
messages was because you hadn't placed the JAR containing your
log4j.xml in your EAR's classpath (under your EAR's /lib dir).

Let me know if you still run into any problems.


Jan

>-----
>Jason Lee
>Programmer/Analyst
>http://www.iecokc.com
>
>
>
>
>>-----Original Message-----
>>From: Jan.Luehe_at_Sun.COM [mailto:Jan.Luehe_at_Sun.COM]
>>Sent: Tuesday, August 29, 2006 9:17 PM
>>To: users_at_glassfish.dev.java.net
>>Subject: Re: Log4j is not logging
>>
>>Hi Jason,
>>Can you send me your complete log4j.xml, including its
>>DOCTYPE declaration?
>>Do you see any errors in the server.log?
>>
>>When I tried using a log4j.xml config file, I saw this error
>>in server.log:
>>
>> log4j:ERROR DOM element is - not a <log4j:configuration> element.
>>
>>I'll need to investigate.
>>
>>Using a log4j.properties works for me, though.
>>
>>Can you switch from using log4j.xml to using log4j.properties
>>for the time being?
>>
>>Thanks,
>>
>>
>>Jan
>>
>>
>>
>>
>>>
>>>-----
>>>Jason Lee
>>>Programmer/Analyst
>>>http://www.iecokc.com <http://www.iecokc.com/>
>>>
>>>
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>>
>>
>>------------------------------------------------------------------------
>>
>><?xml version="1.0" encoding="UTF-8" ?>
>><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
>>
>><log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
>> <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
>> <param name="Target" value="System.out" />
>> <layout class="org.apache.log4j.PatternLayout">
>> <param name="ConversionPattern" value="%d{DATE} %5p %c{1}:%L - %m%n" />
>> </layout>
>> </appender>
>>
>> <appender name="file" class="org.apache.log4j.RollingFileAppender">
>> <param name="File" value="d:/java/logs/Oprah/OrderTransfer.log" />
>> <param name="MaxFileSize" value="10MB" />
>> <param name="MaxBackupIndex" value="5" />
>> <layout class="org.apache.log4j.PatternLayout">
>> <param name="ConversionPattern" value="%d{DATE} %5p %c{1}:%L - %m%n" />
>> </layout>
>> </appender>
>>
>> <category name="com.iecokc">
>> <priority value="debug" />
>> <appender-ref ref="file" />
>> </category>
>>
>> <root>
>> <priority value="error" />
>> <appender-ref ref="stdout" />
>> <appender-ref ref="file" />
>> </root>
>>
>></log4j:configuration>
>>
>>
>>------------------------------------------------------------------------
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>