aspose file tools*
The moose likes JBoss/WildFly and the fly likes How to filter out INFO messages coming  in Sys log server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "How to filter out INFO messages coming  in Sys log server" Watch "How to filter out INFO messages coming  in Sys log server" New topic
Author

How to filter out INFO messages coming in Sys log server

Amey Chitre
Greenhorn

Joined: Mar 18, 2009
Posts: 9
Hello All,


Have redirected the Jboss Application logs to Sys log server I have to filter out the INFO messages & only want to redirect the FATAL error & Warning messages from the application to the message server.

Also would like to mention that the Log4j setting is done in my application itself.

Please suggest

Thanks,
Amey




SCJP
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Which version of JBoss AS?

Usually you want to set the filter for the appender to WARN.

Also, it would help if you poster the text for your sys log appender...


JBoss In Action
Amey Chitre
Greenhorn

Joined: Mar 18, 2009
Posts: 9

Hello Peter,

Jboss AS used is jboss-4.2.3.GA


In the property file which i mentioned sys log appender content is as follows


log4j.rootLogger=INFO,R1,CA,SYSLOG (Added entry for sys log)



log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.Facility=LOCAL7
log4j.appender.SYSLOG.FacilityPrinting=true
log4j.appender.SYSLOG.SyslogHost=10.11.52.195
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
log4j.appender.SYSLOG.layout.ConversionPattern=[%d{ABSOLUTE},%c{1}] %m%n

Please suggest how to redirect only WARN & ERROR message.


Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10202
    
166

Amey Chitre wrote:

log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender


The javadoc of that class http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/net/SyslogAppender.html shows that it accepts a Threshold attribute which controls what level of logs are handled by the appender http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/AppenderSkeleton.html#setThreshold%28org.apache.log4j.Priority%29.

So add the following to the properties:



That way any logs at level WARN and above (including ERROR and FATAL) will be handled by that appender.

[My Blog] [JavaRanch Journal]
Amey Chitre
Greenhorn

Joined: Mar 18, 2009
Posts: 9
Thanks a lot Jaikiran will try that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to filter out INFO messages coming in Sys log server