Tomcat6 webapp using log4j for logging, cannot log into syslog

I am trying to log my webapp logs in syslog at local4 level. Environment: Tomcat6, OpenSolaris, Struts2, log4j. The contents of my log4j.properties is as follows:

log4j.rootLogger=INFO, SYSLOG
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.syslogHost=localhost
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
log4j.appender.SYSLOG.layout.ConversionPattern=%d [%t] %-5p - %m%n
log4j.appender.SYSLOG.Facility=local4

I edited the /etc/syslog.conf file and added the following lines at the end:

local4.notice              /var/log/mylog.log

After that, I restarted the syslog service. When I run the following command from the shell, it is correctly written to /var/log/mylog.log. This basically means the syslog service is working correctly -

logger -i -p local4.notice -t "check  log" "test message"

But I totally don’t understand why the logs from webapp never get into /var/log/mylog.log. Is log4j configuration correct for SysLogAppender?

, "DailyRollingFileAppender" .., .. SyslogAppender .

! -Keshav

+3
2

syslog , syslog . "logger -i -p" , ...

+2

Ubuntu 10.04, /etc/rsyslog.conf, SyslogAppender.

# provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
+7

Source: https://habr.com/ru/post/1715529/


All Articles