Loging a distributed application ? any patterns/framework available?
Hi all,
I want to write a logging mechanism to an distributed application using Log4j such that I need to get the logs of the whole application in a single file.
Currently I have logged that application that runs in a single machine.but I want the log mechanism to work when the application gets distribured.
The application runs in Tomcat.
How do I achive that?
Please help me
[414 byte] By [
sudarsona] at [2007-10-2 0:37:42]

There is a simple way to do it. Make one class accept all the logging messages, call it the DistributedLogger. Make sure DistributedLogger implements the distributed Singleton pattern. There are lots of examples of this using google.
http://www2-data.informatik.unibw-muenchen.de/People/ansgar/dito/patterns/singleton.html
// old way
public void myMethod() {
logger.error(...);
}
->
// new way
public void myMethod() {
DistributedLogger.getInstance().error(...);
}
Thanks a lot for your reply!!!
Please help me on how to make the distributed logger Object visible to other so that they can write on it.
Currently I have created a logger object and access that object in all the java programs.
now if the application goes distributed how will that Happen?
Please help me out of this Issue by letting me know the URL of some web pages that gives some samples.
Thanks and waiting for your reply.
Thanks a lot for your reply!!!
Please help me on how to make the distributed logger Object visible to other so that they can write on it.
Currently I have created a logger object and access that object in all the java programs.
now if the application goes distributed how will that Happen?
Please help me out of this Issue by letting me know the URL of some web pages that gives some samples.
Thanks and waiting for your reply.
I prefer a queue appender. That way the app can continue to operate even if the logging database goes down. Write the message to the queue, have a MessageListener take it off and insert it into the database.
Log4J comes with a JMSAppender that uses Topic; it's an exercise to write it to use a Queue. It's an elegant design.
%