This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes configuring log4j using env variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "configuring log4j using env variables" Watch "configuring log4j using env variables" New topic

configuring log4j using env variables

Harjit Singh
Ranch Hand

Joined: Feb 01, 2007
Posts: 77
Hi there,

Is there any way to configure the log4j file using environement variables. We don't want to hard code the path in the log4j configuration file.


- Harjit
Joe Ess

Joined: Oct 29, 2001
Posts: 8834

I'm not aware of any functionality to do so in the Log4j API.
You can programmatically configure Log4j as described in the manual (scroll down to "configuration"). There's no reason you couldn't read environment variables to get those settings.

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: configuring log4j using env variables
Similar Threads
log4j - different log file based on Threshold value
How can I get OS environment variables in log4j
log4j error message - please send solutions
Third party libraries and WSAD 5.1.0
Path to locate properties file of log4j