You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Ahmed, Yassir" <ya...@mackenziefinancial.com> on 2005/12/15 20:16:32 UTC

Customized Log4J for File Appender and Syslog Appender

Hi,

I need some help configuring Log4j. The requirement is that all the "info" logging goes to File Appender. But all the "error" logging go to unix syslog. I did this without any problems

log4j.rootLogger=INFO, stdout, logfile, syslog
log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logfile.File=/log/keystone/keystone.log
log4j.appender.logfile.datePattern='.'yyyy-MM-dd
log4j.appender.logfile.append=true
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - <%m>%n

log4j.appender.syslog = org.apache.log4j.net.SyslogAppender
log4j.appender.syslog.layout=org.apache.log4j.PatternLayout
log4j.appender.syslog.SyslogHost=localhost
log4j.appender.syslog.Facility=KERN
log4j.appender.syslog.threshold=ERROR


Now, we want to have more control on sending messages to syslog. For example, we want to have a log error message that also add customized description with the message. Something like
log.error ("module name", GLOBAL.ERROR, "short description", "action to be taken by support guys") and no develper should be able to call
log.error("String")

Any idea whats the best way to do this.

Thank you



This e-mail and any attachments may contain confidential information. Any
distributing, copying or reliance upon the contents of this e-mail by anyone other
than the intended recipient is strictly prohibited. If you have received this e-mail
accidentally, please delete it and notify the sender. Although this message has been
screened for viruses, we cannot guarantee that our virus scanner will detect all
viruses and take no responsibility for any damage or loss that may be caused by its
contents.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org