This content has been marked as final. Show 3 replies
log4j can be directed to any output stream... including a Socket connected to another pc.
you still need to write a small application that receives the log4j data and writes it to a log file.
You just need to run a log4j socket server java process on the logging server ( where all of your logs will be written )
java org.apache.log4j.net.SocketServer port configFile configDir
Then on each of your respective servers you need to setup you log4j.properties or xml configuration to point to the logging server with a SocketAppender
I have not done this myself, but it looks straight forward, and I don't think it requires any custom development. You will just have an extra logging server to manage.
Hi All. I have created a simple guide to setting up a log4j socket server.
Log4j has a class called org.apache.log4j.net.SocketServer. This class is capable of receiving log messages over a socket and processing them through any of the supported Log4j Appenders. In my example I show how to use the SMTPAppender, and I setup a log4j socket server on my unix box to listen for log messages and process them. All of your clients, or tomcat servers in your case, could then send their messages to the central log4j socket server.
Its pretty easy to do, checkout my writeup at: