Adding a Filter to an Appender in a Properties File Configuration
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Andrew_Jans
Posted On:   Wednesday, November 6, 2002 09:25 PM

How do I add a Filter to an Appender in a Properties file. I tried the following: log4j.appender.M1.filter=org.apache.log4j.varia.LevelRangeFilter log4j.appender.M1.filter.AcceptOnMatch=true log4j.appender.M1.filter.LevelMin=ERROR log4j.appender.M1.filter.LevelMax=FATAL but get this error when I run the code: log4j:WARN Failed to set property [filter] to value "org.apache.log4j.varia.LevelRangeFilter". Nicely, enough, this only causes that appender to not work, and the rest of the logging proceeds normally. Thanks in advance! Andrew    More>>

How do I add a Filter to an Appender in a Properties file.
I tried the following:


			
log4j.appender.M1.filter=org.apache.log4j.varia.LevelRangeFilter
log4j.appender.M1.filter.AcceptOnMatch=true
log4j.appender.M1.filter.LevelMin=ERROR
log4j.appender.M1.filter.LevelMax=FATAL


but get this error when I run the code:


			
log4j:WARN Failed to set property [filter] to value "org.apache.log4j.varia.LevelRangeFilter".


Nicely, enough, this only causes that appender to not work, and the rest of the logging proceeds normally.

Thanks in advance!

Andrew    <<Less

Re: Adding a Filter to an Appender in a Properties File Configuration

Posted By:   Andrew_Jans  
Posted On:   Monday, November 18, 2002 12:42 PM

Well, I found a compromise, you can actually use both Configurators. So the Property File configurator can setup basic options using the Properties Configurator (I load these from a Properties File in the JAR), and then, if an XML file location is specified in the local properties (my app takes a system property that specifies the file to load), the DOM Configurator is used. It works like a charm, guarantees that I have basic logging covered and allows the system admin to setup complex logging if they want to do so.

Re: Adding a Filter to an Appender in a Properties File Configuration

Posted By:   Adrien_Meaudre  
Posted On:   Thursday, November 14, 2002 02:50 PM

The filter feature is only available with the DOMConfigurator (unavailable with the PropertyConfigurator).

So you must modify your code replacing PropertyConfigurator with DOMConfigurator and rewrite your configuration file under XML.

Hope this could help.

Re: Adding a Filter to an Appender in a Properties File Configuration

Posted By:   Christopher_Schultz  
Posted On:   Friday, November 8, 2002 12:12 PM

There's a property that you can set in log4j.properties (I think it's log4j.debug=true) that will give you verbose debugging information. Perhaps it will give you more information.



Hope that helps,

-chris
About | Sitemap | Contact