[logback-user] conditionals in logback.xml?

Ceki Gulcu ceki at qos.ch
Thu Jun 4 16:42:54 CEST 2009



Thorbjørn Ravn Andersen wrote:
> Ceki Gulcu skrev  den 04-06-2009 12:52:
>>
>>
>> Joran does not come with conditional support. However, it could be
>> added. Assuming the necessary support was there, how would the
>> conditional segments look like?
> 
> Well, I would either think an
> 
> <if test="...">
> xml snippet
> </if>
> 
> construction, where the snippet was only evaluated if the test was true, or
> 
> <appender-ref ref="..." if="${enable.appender.FOO}">
> 
> would be nice.

The implementation of the

   <if test="...">
     nested xml
   </if>

variant would be quite different then the implementation of

   <appender-ref ref="..." if="...">

The former would require broader changes than the latter variant. I
suggest that you enter a jira issue requesting either or both
features. I'll implement the first variant (which is more general) and
if that fails, fallback on the second.

> (Oh, and I found that changes in FileAppender options (changing true to 
> false, etc) are not picked up when reloading default configuration over 
> JMX).

What do you mean?


-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch


More information about the Logback-user mailing list