After I got the access logs for our Tomcat‘s to syslogd (see the entry below), I found that the Solaris syslogd can not handle the the RFC-5424 header format:-( So the info in that section was not really useful for us.
That brought up a new problem, I needed to include the process ID in the log records. So I updated my little extension jar to handle an extra %P format specifier for the SyslogAccessLogValve class.
The normal log4j 1.2 also has no real way to include the process ID in the records. So I added a little org.apache.log4j.PidPatternLayout which handles the %P in addition to the normal PatternLayout.
The new jar file with both the sources and all the classes is here;-) mw2.jar
I hope it helps some people. Have fun playing,
— Marco
Update: Here is a new version of the jar: mw3.jar which hopefully removes the StringManager dependency for Tomcat7. I still did not test it with Tomcat7!!
Update: Next post in what becomes a series?!
It is fantastic, very much appreciated!
It works great on a Windows tomcat host as well.
Many thanks, however on tomcat7 I get java.lang.NoClassDefFoundError: org/apache/catalina/util/StringManager for both versions of your jar
Jarfinder says the class is in catalina.jar, for versions <= tomcat 6, and gwt-dev (??)
I would try to leave out the sm field, but not yet pulled out my eclipse.
try the mw3.jar;-)
Oops, also fixed in the meantime: https://github.com/magwas/SyslogValve
Tested yours as well, works like a charm. Thank you for the excellent work!
I do not want to be a shameless forker, what should I do?
That’s fine;-) I’m happy that it works for you. Have fun.
Pingback: Apache Tomcat Access Log to Syslogd - Marco's Corner
Pingback: Apache Tomcat and Logging – The 3rd - Marco's Corner
Thanks for this it has been a great help. Any plans for a Tomcat 8 compatible version? Just wondering (I know it has been a few years now but i thought i`d ask anyway).
I don’t use Tomcats right now. So not really, sorry.
Hi, thanks for Your great works, it has been very helpful for our logging infrastructure.
However, we use Tomcat 8 now, and we’ve forked in our repository here:
https://github.com/KMK-ONLINE/SyslogValve.git which is supposed to work for Tomcat 8.
Some performance adjustment to this first modification is still required, though.
OK, I forked your code and made some changes again. I should have put it into a github repo a long time ago. But originally, this was a quick hack and I thought, I’m done. But it’s coming back all the time;-)