janetsmith
janetsmith

Reputation: 8732

How to use external log4j.properties for multiple projects?

I have a main project, which depends on multiple projects (in eclipse).

At the end of the project, I will generate a runnable jar and a log4j.properties. This properties file is an external file, so my client can modify it at will (email address etc).

runnable.jar + log4j.properties.

At the same time, those projects which the main project depends on, have their own log4j properties files.

I want to centralize the setting in log4j.properties into one external file. How to do that?

Upvotes: 1

Views: 5136

Answers (2)

ZZ Coder
ZZ Coder

Reputation: 75496

If you add a JVM parameter -Dlog4j.configuration="file://anywhere/anyfile", all your components will use the same configuration. You can combine all your log4j configuration in this one big file. Is this what you mean by centralizing?

Upvotes: 3

Yishai
Yishai

Reputation: 91911

You will have to copy the relevant settings of the log4j.properties from the other projects into your file. But I guess the real question is: Why would you want to do that? Normally you would not care about logging those other projects in detail. A general root level should cover them just fine. And if you do care, you should care in a way that is different from their default.

Upvotes: 0

Related Questions