You could try writing logs to a database, JMS, or a Socket.

On 10/17/06, Cohen Oren (ICS) <[EMAIL PROTECTED]> wrote:
Hi

Short description of the problem:
"I need the best log4j configuration for - Multiple threads that log
events to the same file concurrently"

I work on a multithreaded environment (between 10-20 threads).
I want all the threads to log their events to the same log file.
Currently, there are 3 Loggers in the system - all of them are by
default sons of the RootLogger.

I are running some load tests and facing some performance difficulties.
I tried 2 major setups in my log4j.xml :

First setup:
RollingFileAppender - attached to the RootLogger.

The performance is bad because log4j locks (synchronize) the
Category/Logger until it finishes writing into it.
Most of the threads are waiting until the lock on the RoorLogger is
finished (because it has the appender).

Second setup:
AsyncAppender - attached to the RootLogger.
RollingFileAppender - attached to the AsyncAppender .

The buffer of the AsyncAppender is synchronized,
and as mentioned before - the loggers are also synchronized when start
appending to them.
Most of the threads are waiting until the lock on the RoorLogger is
finished.

I took many advices from the log4j book (enlarge the buffer of
AsyncAppender, use BufferedIO in the RollingFileAppender, omit
locationInfo etc.)
However, I still don't have a good configuration for my very simple case
which is:
        "multiple threads that log events to the same file concurrently"

Can you help ?

Thanks a lot !

Oren





--
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to