This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes log4j - File Appenders.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j - File Appenders.." Watch "log4j - File Appenders.." New topic

log4j - File Appenders..

Antonio Giovanni
Ranch Hand

Joined: Jun 27, 2005
Posts: 85
Hi all,..

Is there a way to have the log4j log file (declared in within the web application - say WEB-INF/logs/example.log

I am not really sure how to give this relative path to file appenders in My :

I appreciate your ideas on this.
Thanks again
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Using a "relative path" in a web application means relative to the application server's working directory. There's only one working directory for a JVM so it can't be related to any of the applications being run in the server. And that makes it useless for you.

You can put "${abc}" into a log4j configuration file and the configurator will replace that with the value of the "abc" Java system property. But again, system properties are one-per-JVM and not one-per-webapp so that probably isn't much more helpful.

Besides, if you put the logs into the web app then when you install a new WAR or EAR file, you lose all of those logs. You might want to consider logging to a fixed location outside of the application server.
Antonio Giovanni
Ranch Hand

Joined: Jun 27, 2005
Posts: 85
Thanks Paul Clapham

I think i will follow what you said - have the log file outside of the application server.
I agree. Here's the link:
subject: log4j - File Appenders..
It's not a secret anymore!