users@glassfish.java.net

Re: Log4j is not logging

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Wed, 30 Aug 2006 08:22:54 -0700

Jason Lee wrote On 08/30/06 07:48,:

>Hmm... That didn't seem to fix anything. I'm still not getting any
>logs. Here's my log4j.properties:
>
>log4j.rootLogger=DEBUG, file
>
>log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>log4j.appender.stdout.Target=System.out
>log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>log4j.appender.stdout.layout.ConversionPattern=%d{DATE} %5p %c{1}:%L -
>%m%n
>
>log4j.appender.file=org.apache.log4j.RollingFileAppender
>log4j.appender.file.layout=org.apache.log4j.PatternLayout
>log4j.appender.file.layout.ConversionPattern=%d{DATE} %5p %c{1}:%L -
>%m%n
>log4j.appender.file.File=/java/logs/Oprah/OrderTransfer.log
>log4j.appender.file.MaxFileSize=10MB
>log4j.appender.file.MaxBackupIndex=5
>
>log4j.logger.com.iecokc=DEBUG
>
>I tried the same config in a stand-alone, command line app, and it works
>as expected. Am I possible packaging this incorrectly in my .ear? I
>vaguely remember a blog entry suggesting the log4j config needs to go in
>a jar in $EAR/lib. Is that correct?
>
>

Correct, that's the default location for JAR packaged libs,
which may be overridden using the library-directory element
of the .ear file's deployment descriptor.

I've attached one of my earlier replies to this alias.


Jan


attached mail follows:



Hi Ben,

ben short wrote On 06/08/06 15:02,:

> Hi,
>
> I want to use log4j but where should the log4.properties file be
> inside my ear file?


I've wrapped my log4j.properties into a JAR file (log4jProperties.jar),
and stored it in my EAR file's lib directory, along with the log4j and
commons-logging JAR files, so my EAR file's layout looks like this:

  /META-INF/application.xml
  /lib/log4j-1.2.13.jar
  /lib/commons-logging-1.1.jar
  /lib/log4jProperties.jar
  /test.war

The contents of my /META-INF/application.xml are as follows:

  <application ...>
    <module>
      <web>
        <web-uri>test.war</web-uri>
        <context-root>/test</context-root>
      </web>
    </module>
  </application>

With this, my servlet resource in test.war was able to log to log4j.

Let me know if this doesn't work for you.


Jan

>
> Ben
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>