Istvan
Istvan

Reputation: 8572

How to override log4j properties for all the imported Java libraries?

I am using Clojure but I think this is irrelevant to the question. I would like to override the log4j properties for all the imported libraries and have the exact same format for all. Right now it looks like this:

2014-11-26 19:37:19.399 INFO net.spy.memcached.auth.AuthThread:  Authenticated to ae-couchbase10/10.52.61.37:11210
INFO: {:thread-name async-dispatch-2, :first_id batch::test::dev::934ebce6-b78d-4f7c-b297-f636cbfeca0c::8307a507-7deb-40dc-811a-b339148472e7, :time 171.587344, :perf 5.967806110455326}

What is the best way of doing that?

Upvotes: 1

Views: 602

Answers (2)

Tim X
Tim X

Reputation: 4235

Agree witht he use of log4j.xml.

The cloure Luminus framework has a nice default setup for using log4j. Strongly encourage laziness and recommend ahving a look at that for one way of handling log4j setup in clojure projects.

Upvotes: 0

Paul Vargas
Paul Vargas

Reputation: 42040

If you use XML-based configuration, ie the log4j.xml file, this will have a higher priority over any log4j.properties file that exists in any library.

But if you require the properties file, add an argument to the Java Virtual Machine, e.g.:

java -Dlog4j.configuration=file:/tmp/log4j.properties KillerApp

Upvotes: 2

Related Questions