LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Blogs > NullTerminator
User Name
Password

Notices

Rate this Entry

Log4j Message Filtering

Posted 09-07-2012 at 12:54 PM by NullTerminator
Updated 09-13-2012 at 12:27 PM by NullTerminator

Some Notes on built in filtering facility

http://logging.apache.org/log4j/1.2/...tchFilter.html
org.apache.log4j.varia.StringMatchFilter - this is a "contains" match paradigm.
Followup: This actually uses the indexOf method for matching, so it acts like a "contains" match, and IS CaseSensitive.

possible specification in an appender tag
extend from an example at http://stackoverflow.com/questions/4...-the-log4j-xml
NOTE: THIS IS UNTESTED YET.
<filter class="org.apache.log4j.varia.StringMatchFilter">
<!-- skip messages from this class -->
<param name="StringToMatch" value="my.co.package.class" />
<param name="AcceptOnMatch" value="FALSE" />
</filter>

Source Ref:
http://javasourcecode.org/html/open-...lter.java.html

log4j.dtd excerpt
Code:
<!-- Appenders must have a name and a class. -->
<!-- Appenders may contain an error handler, a layout, optional parameters -->
<!-- and filters. They may also reference (or include) other appenders. -->
<!ELEMENT appender (errorHandler?, param*, layout?, filter*, appender-ref*)>

There is also a LogfilePatternReciever that can tail or parse a log file and create events. Don't know much about how that works. It only uses a simple * as a wildcard pattern.
http://logging.apache.org/log4j/comp...nReceiver.html
Posted in Uncategorized
Views 479 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 08:13 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration