Basically My application is distributed across two or more tomcat servers running in multiple machines.And I get a log4j logs in the respective machines.
But I want a consolidated log message in a single machine.
How do i get that done??
Any samples?? Any clues??
Any specific technoliges??
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: