View Full Version : Logging
ballsuen
Jul 18th, 2007, 01:03 PM
In my project, services will be shared among online transactions and batches.
I want the logs written by the same logging statement in a service to be separated to two different log files for online and batch. How can that be done?
Marten Deinum
Jul 18th, 2007, 01:20 PM
This really hasn't anything to do with the Spring Batch project.
The answer is related to your logging framework. In Log4j and Logback you have something called a MDC, there you can set (per thread/per...) some settings which also get printed in the logfile. logback (http://logback.qos.ch/manual/mdc.html)
ballsuen
Jul 19th, 2007, 01:16 PM
When the logs are being written by multi-thread processes during batch, is it possible that it would cause contention. Or log4j has its own mechanism to address that?
Alarmnummer
Jul 19th, 2007, 03:16 PM
You could have a look at the following:
http://logging.apache.org/log4j/docs/api/org/apache/log4j/AsyncAppender.html
ballsuen
Jul 19th, 2007, 10:52 PM
Is AsyncAppender a singleton thread inside the system?
Will it queue the logging events internally such that no concurrent logging will occur to the same log file in the same moment?
dejanp
Jul 20th, 2007, 04:49 AM
Imo - high (high meaning hundreds of thousands of messages per day) throughput/ high concurrency systems shouldn't use detailed levels of logging. If you need audit for all the messages you shouldn't rely on logging.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.