You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Shapira, Yoav" <Yo...@mpi.com> on 2003/07/03 19:52:42 UTC

RE: Specifying log file location when moving from development to production

Howdy,

>I have to remember to swap which line is commented out when I move the
app
>to production.  I forget where the log file wants to go naturally (with
no
>path) on Unix, but it wasn't the same place as on Windows.  Then if you
>start Tomcat as an NT service as a coworker of mine does, the log file
>wants
>to go somewhere else entirely, so the relative path doesn't work.
>
>Has anyone got a way to deal with this programmatically, either one
setting
>that will work for both Windows and Unix, or something that Ant can do,
>or... ?

If I'm doing something simple / quick / in house I use Ant's copy with
filtering.  So my log4j.properties file looks like:
log4j.appender.blah.File=@logFile@

And the ant <copy> task that copies log4j.properties to its deployment
location has filtering="true" and a logFile token with the appropriate
value.

Another approach is to use an environment variable, e.g.
log4j.appender.blah.File=$CATALINA_HOME/logs/myFile.txt

When I'm doing something long-term / for external customers, I typically
stick an <env-entry> in web.xml and let the server administrator plug in
the appropriate value (for tomcat, this would be an <Environment> entry
in server.xml).  This JNDI approach is very portable.  It works for me
as I like to configure log4j programmatically anyways.

Yoav Shapira



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