I need to log events to the syslog
on the localhost only. My first trial was with the logback
SyslogAppender
, but it looks like it writes the logs through UDP. The problem is that the syslog
daemon needs to be configured to access remote logging, which i can't guarantee on all deployment targets. Is there any way to log to syslog
"directly" ( the way /bin/logger
would do it) from JAVA? ( i mean, without needing to go through UDP or TCP)
Asked
Active
Viewed 1,286 times
2

Chirlo
- 5,989
- 1
- 29
- 45
2 Answers
0
I would guess you could invoke /bin/logger directly, but you would need to write a new adapter to do so. The "easiest" thing could be subclassing the current adapter to get all the scaffolding and only override the snippet sending the message.
You may want to do some experiments on whether you can write a simple Java program invoking /bin/logger, to see if this is a viable way.

Thorbjørn Ravn Andersen
- 73,784
- 33
- 194
- 347
-
Thought of that, but this would "tie" me to /bin/logger, which was something i wanted to avoid . – Chirlo Oct 03 '12 at 09:30
0
Just across similar issue and found SysLog4J. Unfortunately it has not been actively developed since 2011.
Some alternative packagings exist - this seems to be fresh and alive: https://github.com/Graylog2/syslog4j-graylog2
Edit: A bit better answer is already part of the following question: Using Syslog's unix socket with Log4J2 :)