[logback-user] Logback configuration

Sebastien Pennec sebastien at qos.ch
Thu Mar 15 09:06:34 CET 2007


Hello Andy and Anders,

We've modified Joran to add this feature yesterday.

The repository version now allows you to set an <include> element in a configuration 
file, and set a file="" attribute. This attribute can be specified by using a property.

We could have:

<configuration>
   <include path="${path.to.file}" />
</configuration>

The target file must use the following elements:

<included>
  <!-- add here any configuration element: Appender, layout, logger, ... -->
</included>

Would that do the trick you, Anders?

Sébastien

Gerweck Andy - agerwe wrote:
> I thought that there was some agreement that Joran would (or should) include the capability to include a file based on a system property, which provides exactly the required functionality without making this a special case. 
> 
> A way to switch the configuration at runtime is a hard requirement for several applications I develop. Making this part of Joran (possibly providing a short sample that gets everything from a property) seems like a great solution that could be helpful in many situations (especially with conditionals and regex captures). 
> 
> There was an email thread covering this on 2/8.
> 
> Thanks,
>  Andy Gerweck
> 
> -----Original Message-----
> From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On Behalf Of Ceki Gülcü
> Sent: Tuesday, March 13, 2007 2:18 PM
> To: logback users list; logback-user at qos.ch
> Subject: Re: [logback-user] Logback configuration
> 
> Hello Anders,
> 
> If you don't have a J2EE container, using a context selector is a major 
> overkill. If you tell us that it would not be possible to package a 
> different copy of logback.xml in each standalone application, then we will 
> add the functionality you requested, i.e. specifying the configuration file 
> through a system property. (I am not very fond of this feature, but if you 
> really need it, we'll be happy to oblige.)
> 
> After you have ascertained that packaging a distinct copy of logback.xml in 
> each application is not an option, could you please you file a 
> bug/enhancement report?
> 
> At 01:30 AM 3/13/2007, Anders Wallgren wrote:
> 
>> We're not running inside a J2EE container, rather this is a set of standalone
>> applications launched out of the same classpath.
>>
>> As it stands, I don't think ContextSelector will help, unless there's some
>> custom implementation of that interface that I could put together to do the
>> right thing.  I'm not yet familiar enough with logback to answer that
>> myself, so your input is appreciated.
>>
>> anders
> 

-- 
Sébastien Pennec
sebastien at qos.ch

Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch/



More information about the Logback-user mailing list