File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 9189

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.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: configuring log4j using env variables
It's not a secret anymore!