[logback-user] Is there System properties configuration?

Laedret Henric.Larsson at igindex.co.uk
Fri Jan 11 12:16:23 CET 2008


Hi,

I'd like to "ask" for this feature. For two reasons, the first being easier
migration from log4j. The second because the classpath hack is rather ugly.
It's too easy to have someone sneak in a logback.xml or loback-test.xml
somewhere in the classpath by mistake or on purpose as part of some library
and suddenly there's a world of pain trying to work our what jar file
amongst hundreds that contains it. 

It's a way of telling the application to use a specific file and no other
file and there's no questions about which file was used. Personally I prefer
being explicit about this, because of experience with log4j config's
littered around various libraries.

I think your point is valid that keeping things simple makes learning and
using logback simpler but having the option to specify the name of the file
adds flexibility without any real cost in complexity.


The way logback looks for the test config before the regular config is
brilliant for development purposes and the case where an application only
needs one production config, but at least in our production environment we
deploy the same application in various enviroments and they all need
different log configs - which we currently solved by having more than one
log config as part of the application bundle and specifiying the path/name
as a system property.

$0.02

Cheers,
Henric









Ceki Gulcu-2 wrote:
> 
> 
> 
> There are no such plans. At this time, we try to offer only features users 
> actually ask for. On the long term, this is beneficial for both developers
> and 
> users. Less code to maintain for us and easier for users to grasp the
> library 
> (less things to learn).
> 
> 
> thebugslayer wrote:
>> this will work.
>> 
>> Is there plan to add user specifiy config file in the future? I found
>> that is easier to instruct end user rather than affecting classpath.
>> 
>> Thanks.
>> -zemian
>> 
>> 
>> On 10/13/07, Ceki Gulcu <listid at qos.ch> wrote:
>>> Thank you for your answer. As things stand currently, you can't do that
>>> using
>>> logback except by modifying the class path. As in
>>>
>>> java -cp ../resources1/;otherClasspathEntries -jar mytool.jar
>>> java -cp ../resources2/;otherClasspathEntries -jar mytool.jar
>>> java -cp ../resources3/;otherClasspathEntries -jar mytool.jar
>>>
>>> In addition, you would need to place customN.xml in
>>> resourceN/logback.xml, where
>>> N is in {1, 2, 3}.
>>>
>>> Would that work for you?
>>>
>>>
>>> thebugslayer wrote:
>>>> Hi Ceki,
>>>>
>>>> This feature was in log4j, and it allow me  to publish tool that allow
>>>> end user do this:
>>>>
>>>> java -Dlog4jconfiguration=custom1.xml -jar mytool.jar
>>>> java -Dlog4jconfiguration=custom2.xml -jar mytool.jar
>>>> java -Dlog4jconfiguration=custom3.xml -jar mytool.jar
>>>>
>>>> how would I do this in logback?
>>>> -Z
>>>>
>>>>
>>>> On 10/13/07, Ceki Gulcu <ceki at qos.ch> wrote:
>>>>> Hello,
>>>>>
>>>>> No, it is not currently possible to specify the name of the
>>>>> configuration file
>>>>> through a system property. Could you please describe your use case?
>>>>>
>>>>> Cheers,
>>>>>
>>>>> thebugslayer wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I read http://logback.qos.ch/manual/joran.html, it's only checking
>>>>>> classpath for config logback.xml file. Is there a way to specify file
>>>>>> location by System properties?
>>>>>>
>>>>>> Thanks,
>>>>> --
>>>>> Ceki Gülcü
>>>>> Logback: The reliable, generic, fast and flexible logging framework
>>>>> for Java.
>>>>> http://logback.qos.ch
>>>>> _______________________________________________
>>>>> Logback-user mailing list
>>>>> Logback-user at qos.ch
>>>>> http://qos.ch/mailman/listinfo/logback-user
>>>>>
>>>>
>>> --
>>> Ceki Gülcü
>>> Logback: The reliable, generic, fast and flexible logging framework for
>>> Java.
>>> http://logback.qos.ch
>>> _______________________________________________
>>> Logback-user mailing list
>>> Logback-user at qos.ch
>>> http://qos.ch/mailman/listinfo/logback-user
>>>
>> 
>> 
> 
> -- 
> Ceki Gülcü
> Logback: The reliable, generic, fast and flexible logging framework for
> Java.
> http://logback.qos.ch
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-there-System-properties-configuration--tp13058967p14753651.html
Sent from the Logback User mailing list archive at Nabble.com.




More information about the Logback-user mailing list