I want to specify a unique log4j.properties file on the java command line to
be used by the client application being run. I do this like this:

java ... -Dlog4j.configuration=jet.properties -Dlog4j.debug -cp ...
/bla/app.class

Note that there is a log4j.properties file in the CLASSPATH that is used by
the server portion of my application. There are other application related
properties files that reside in the same directory as the log4j.properties
file.

The debug output from log4j looks like this:

log4j: Trying to find [jet.properties] using Class.getResource().
log4j: Trying to find [java/lang/jet.properties] using
ClassLoader.getSystemResource().
log4j: Trying to find [jet.properties] using
ClassLoader.getSystemResource().
log4j: Using URL [file:/home/e5540g/jet.properties] for automatic log4j
configuration.
log4j: Reading configuration from URL file:/home/e5540g/jet.properties
log4j: Parsing for [root] with value=[DEBUG, logFile].
log4j: Priority token is [DEBUG].
log4j: Category root set to DEBUG
log4j: Parsing appender named "logFile".
log4j: Parsing layout options for "logFile".
log4j: Setting property [conversionPattern] to [%d{ISO8601} %5p [%t] %c -
%m%n].
log4j: End of parsing for "logFile".
log4j: Setting property [file] to [logfile.jet].
log4j: Setting property [datePattern] to ['.'yyyy-MM-dd].
log4j: Appender [logFile] to be rolled at midday and midnight.
log4j: Parsed "logFile" options.
log4j: Finished configuring.
log4j: Reading configuration from URL
file:/home/e5540g/props/log4j.properties
log4j: Parsing for [root] with value=[ERROR, logFile].
log4j: Priority token is [ERROR].
log4j: Category root set to ERROR
log4j: Parsing appender named "logFile".
log4j: Parsing layout options for "logFile".
log4j: Setting property [conversionPattern] to [%d{ISO8601} %5p [%t] %c -
%m%n].
log4j: End of parsing for "logFile".
log4j: Setting property [file] to [nosi].
log4j: Setting property [datePattern] to ['.'yyyy-MM-dd].
log4j: Appender [logFile] to be rolled at midday and midnight.
log4j: Parsed "logFile" options.
log4j: Parsing for [com.erac.vaa.nosi.sync.controller] with value=[DEBUG].
log4j: Priority token is [DEBUG].
log4j: Category com.erac.vaa.nosi.sync.controller set to DEBUG
log4j: Handling log4j.additivity.com.erac.vaa.nosi.sync.controller=[null]
log4j: Finished configuring.

Log4j finds my jet.properties file but then continues searching the
CLASSPATH
and finds a log4j.properties file which is NOT what I intended! I would
expect
that if I specify a specific properties file via -Dlog4j.configuration this
would take precedence.

Any ideas on how to make log4j just use the properties file that I specified
on the command line?

Maybe I could have two uniquely named properties files one for each side of
the 
application (client and server) neither of which is named log4j.properties?

Thanks in advance for any thoughts on this.

-J

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to