logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: Creating log files relative to the web applications root directory?
Date Mon, 11 Aug 2003 13:05:28 GMT

What I've seen done to achieve this is have my ant deployment script
fill the value when copying log4j.xml over.  So in log4j.xml, you'd have

<param name="File" value="@logFilePath@" />

And in your ant script, you set filtering="true" when copying log4j.xml,
and replac the logFilePath token with the actual (absolute) path.

As an aside, note that the servlet container is not required to give you
write access under your webapp's root.  In fact, many server admins
dislike this, as they prefer a centralized log location for their
systems.  But if you're the server admin, you're king ;)

Yoav Shapira
Millennium ChemInformatics

>-----Original Message-----
>From: Adrian Beech [mailto:a.beech@bigpond.net.au]
>Sent: Monday, August 11, 2003 6:42 AM
>To: 'Log4J Users List'
>Subject: Creating log files relative to the web applications root
>Is it possible to specify a log filename in the XML log4j properties
>that it is relative to the web applications root directory?
>I have the following in a log4j.xml file located in web-inf/classes
>log4j jar in the web-inf/lib directory.  Logging seems to be fine
>"rascal.log" file is being created in the Tomcat application directory
>C:\Program Files\ and not in the C:\Tomcat 4.1\webapps\... Directory
>I'd prefer to have the log files in something like
>../webapps/<application>/logs/<logfilename>.  Is this possible?
>BTW, took a while to find the rascal.log file!!!
>?xml version="1.0" encoding="UTF-8" ?>
><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
>    <appender name="rf" class="org.apache.log4j.RollingFileAppender">
>        <param name="file" value="rascal.log"/>
>        <param name="maxBackupIndex" value="2"/>
>        <param name="maxFileSize" value="250KB"/>
>        <layout class="org.apache.log4j.PatternLayout">
>            <param name="ConversionPattern" value="%d{dd/MM/yyyy
>%-5p (%t) %l - %m%n"/>
>        </layout>
>    </appender>
>    <root>
>        <priority value="debug" />
>        <appender-ref ref="rf"/>
>    </root>
>--[End Of File]-------------------------------------------------------
>I'm using Tomcat 4.1.24 on a Win XP and 2k box for development and
>4.1.24 on a Unix box as the production platform.
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org

View raw message