Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to filter out INFO messages coming in Sys log server

 
Amey Chitre
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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



 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...

 
Amey Chitre
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Amey Chitre
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Jaikiran will try that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic