users@glassfish.java.net

Re: Where to put log4j.properties file

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Fri, 09 Jun 2006 11:38:24 -0700

Ben,

ben short wrote On 06/09/06 01:23,:

> Jan,
>
> Thanks for you help. I have put the log4j.properties in a jar file as
> suggested and it works. But the log file is created in domain1/config
> rather than the log directory.
>
> Here is my log4j.properties file...
>
> log4j.rootCategory=DEBUG, dest1
>
> #### Second appender writes to a file
> log4j.appender.dest1=org.apache.log4j.RollingFileAppender
> log4j.appender.dest1.File=example.log
>
> # Control the maximum log file size
> log4j.appender.dest1.MaxFileSize=100KB
> # Archive log files (one backup file here)
> log4j.appender.dest1.MaxBackupIndex=10
>
> log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
> log4j.appender.dest1.layout.ConversionPattern=%p %t %c - %m%n
>
> Any Ideas?


Yes. The startserv script in your domain's bin directory has this statement:

  cd "$INSTANCE_ROOT/config"

Because of this, the "$INSTANCE_ROOT/config" directory will be used as
the runtime's current working directory, meaning any files with a
relative path name will be created relative to this directory.


Jan


>
> Ben
>
>
>
> On 6/9/06, Jan Luehe <Jan.Luehe_at_sun.com> wrote:
>
>> 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
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>