commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: [logging] Specify the Log4J configuration file from commons-logging.properties
Date Sat, 14 Apr 2012 15:03:09 GMT
2012/4/12 Paul Holding <paul@pholding.co.uk>:
> Is it possible to specify the name of the Log4J configuration file from
> within the commons-logging.properties file?
>
> In the Commons Logging user guide it suggests that this can be done by
> setting the "log4j.configuration" parameter in the
> commons-logging.properties file and that a default of log4j.properties will
> be used if not specified.
>
> I have tried setting "log4j.configuration=log4j-myapp.properties" in
> commons-logging.properties however Log4J throws an error saying that it
> hasn't been configured. The only way I can specify the name of the Log4J
> configuration file seems be using the -Dlog4j.configuration=<your_file> at
> the command line or using System.setProperty("log4j.configuration",
> "<your_file>");
>
> Have I misinterpreted the text in the Commons Logging user guide regarding
> Log4J or is there something I'm missing?

The user guide (1.1.1) says literally:
"log4j.configuration=log4j.properties Use this system property to
specify the name of a Log4J configuration file."

Nowhere it says that commons-logging.properties file has any influence
on the system properties.


So, I disagree with Christian.

I'd say it is Log4J matter how it finds its own configuration file.
>From responsibilities point of view it has nothing to do with Commons
Logging. (Just guessing, without looking at the sources).

The rest of setting mentioned in that section ("log4j.rootCategory"
and below)  are set in log4j.properties file.  This explains for me
the words written above the options list (note the "and"):

"Configure Log4J using system properties and/or a properties file:" (...)


[1] http://commons.apache.org/logging/commons-logging-1.1.1/guide.html#Configuring%20Log4J

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message