View Full Version : Logging
ballsuen
Jul 18th, 2007, 12: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, 12: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, 12: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, 02: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, 09: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, 03: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.
ballsuen
Apr 6th, 2009, 12:44 AM
Anyone knows if I can use AsyncAppender in J2EE/ Websphere environment? I read the source code that it will spawn thread on its own.
Will the threads not being managed by Websphere cause issue?
Dave Syer
Apr 6th, 2009, 02:11 AM
Might be a problem (IBM would certainly not be happy about it), but in practice probably not. If you want to be cautious you would have to write your own appender using CommonJ (or proprietary IBM APIs).
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.