You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Rainer Schuetze <sc...@geoinform.fh-mainz.de> on 2005/11/24 12:17:25 UTC

problem with LevelRangeFilter - don't work well (XML)

Hi,

I tried to filter some important logging events in different files. 
However, the appender logs all levels in the file. Actually, I'm not 
sure which parameter I have to set within the filter element. I suppose 
the parameter for min & max are named wrong.
Is the Filter objective full implemented in Log4cxx yet?

> 
>   <appender name="ERROR" class="org.apache.log4j.FileAppender">
>     <param name="File"   value="./log/error.log" />
>     <param name="Append" value="false" />
> 
>     <layout class="org.apache.log4j.PatternLayout">
>       <param name="ConversionPattern"
>           value="%5p [%t] %5rms - (%d{%H:%M:%S}) (%5L) %c - %m%n" />
>     </layout>
> 
>      <filter class="org.apache.log4j.varia.LevelRangeFilter">
>       <param name="MatchReturnValue" value="accept"/>
>       <param name="LogLevelMin" value="warn"/>
>       <param name="LogLevelMax" value="fatal"/>
>     </filter>
> 
>   </appender>
> 
>   <root>
>     <priority value ="debug" />
>     <appender-ref ref="ERROR" />
>   </root>

I also tried the filter XML-example of the cvs-project which uses the 
LevelMatchFilter (see below), but I wasn't able to filter the log. Do I 
miss something?

>     <filter class="org.apache.log4j.filters.LevelMatchFilter">
>       <param name="MatchReturnValue" value="accept"/>
>       <param name="NoMatchReturnValue" value="deny"/>
>       <param name="LevelToMatch" value="warn"/>
>     </filter>

Thanks for your help,

Rainer


-- 
Rainer Schuetze

i3mainz - Fachhochschule Mainz
Holzstrasse 36
55116 Mainz
Germany

Tel: +49 (0)6131 2859 682
Fax: +49 (0)6131 2859 699
schuetze@geoinform.fh-mainz.de
http://www.i3mainz.fh-mainz.de


Re: problem with LevelRangeFilter - don't work well (XML)

Posted by Rainer Schuetze <sc...@geoinform.fh-mainz.de>.
Hi,
well, the problem with the filter continues. I'm not able to filter the 
loggings to different files.
The basic question are:
* Is the filter implemented in Log4cxx?
* Does somebody have some experience with the Filter and might send me 
an example?!

In my application I'm using the Macro (e.g. LOG4CXX_DEBUG ) for logging. 
  Might the filter be ignored because the Macro calls 
logger->forcedLog(...)?

Has somebody experience with the filtering?

regards,

Rainer

Rainer Schuetze schrieb:
> Hi,
> 
> I tried to filter some important logging events in different files. 
> However, the appender logs all levels in the file. Actually, I'm not 
> sure which parameter I have to set within the filter element. I suppose 
> the parameter for min & max are named wrong.
> Is the Filter objective full implemented in Log4cxx yet?
> 
>>
>>   <appender name="ERROR" class="org.apache.log4j.FileAppender">
>>     <param name="File"   value="./log/error.log" />
>>     <param name="Append" value="false" />
>>
>>     <layout class="org.apache.log4j.PatternLayout">
>>       <param name="ConversionPattern"
>>           value="%5p [%t] %5rms - (%d{%H:%M:%S}) (%5L) %c - %m%n" />
>>     </layout>
>>
>>      <filter class="org.apache.log4j.varia.LevelRangeFilter">
>>       <param name="MatchReturnValue" value="accept"/>
>>       <param name="LogLevelMin" value="warn"/>
>>       <param name="LogLevelMax" value="fatal"/>
>>     </filter>
>>
>>   </appender>
>>
>>   <root>
>>     <priority value ="debug" />
>>     <appender-ref ref="ERROR" />
>>   </root>
> 
> 
> I also tried the filter XML-example of the cvs-project which uses the 
> LevelMatchFilter (see below), but I wasn't able to filter the log. Do I 
> miss something?
> 
>>     <filter class="org.apache.log4j.filters.LevelMatchFilter">
>>       <param name="MatchReturnValue" value="accept"/>
>>       <param name="NoMatchReturnValue" value="deny"/>
>>       <param name="LevelToMatch" value="warn"/>
>>     </filter>
> 
> 
> Thanks for your help,
> 
> Rainer
> 
>