tags:

views:

473

answers:

2

Hi,

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?

A: 

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.

Yishai
I would like to send notification email to the stack holder when something bad happen.
janetsmith
If you can divide by package, then you can divide the logging into different files, or e-mail them directly. But it is going to have to be combined into one file. That is a log4j limitation.
Yishai
+1  A: 

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?

ZZ Coder