简体   繁体   中英

Log4J 2 Syslog Appender not working properly

I'm currently working on a java log forwarder which logs the messages to a remote syslog server. Using the Official Log4J2 manual, I've written the code using SyslogAppender configured via ConfigurationBuilder Factory. It works fine for UDP. But for TCP, it is, kind of buffering all the messages and once the program is terminated it flushes out all the log messages at once as a single log message. I tried setting the immediateFlush field, But no use.

Using the newLine="true" boolean in the Syslog definition worked for me.

Example :

<Syslog name="LogStashSysLog" host="localhost" port="9998" protocol="TCP" newLine="true"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM