xyc 2012-07-26
vi /etc/sysconfig/syslog
sysLOGD_OPTIONS = “-r –m 0” ## -r 意思是接受远程的日志
vi /etc/syslog.conf
service syslog restart
logger -p local5.warning "willim worked"
nc -w0 -u 192.168.0.1 514 <<< "testing again from my home machine"
echo "User Info msg from remote through UDP." | nc -w0 -u nabasiavm5 514 <<< "GGGGGGGGGG"
log4j.logger.syslog =DEBUG, syslogApp
#Appenderconfiguration
log4j.appender.syslogApp=org.apache.log4j.net.SyslogAppender
log4j.appender.syslogApp.SyslogHost=111.111.111.102
log4j.appender.syslogApp.layout=org.apache.log4j.PatternLayout
log4j.appender.syslogApp.layout.ConversionPattern=%m
使用Log4j的SystemLogAppender可以实现远程的日志输出,为集中式的日志管理提供便利。/etc/init.d/syslog start3. 在写日志的客户机上,修改log4j配置文件: