//
you're reading...
Uncategorized

Loading log4j configuration from a file

Yesterday I needed to make log4j load its configuration from a specific file outside
the classpath. Sounds simple enough and according to the docs
all you need to do is setup an environment variable called log4j.configuration. The tricky part, which is easy to miss, is that the path needs to be given as a URI, so for example you may want to run your app like this:

java -Dlog4j.configuration=file:\some\path\log4j.xml -jar myJar.jar
Advertisements

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: