[logback-user] separate task log files (slf4j + logback)

Денис Матвеев denism78 at gmail.com
Wed Oct 18 11:25:08 CEST 2017

Yes, maybe I'm trying to use loggers for dumps, but I wanted to use the 
existing functionality of log-services (Rolling, Sizing, Layout etc.). 
What's bad about it?
Yes, of course, different names are used for different loggers. Having 
created a Logger object with a specific name, I already set some logical 
separation of entities in my program. For example AAA.BBB.Loading - 
everything is written in this logger during loading, and there is a lot 
and this is a detailed logger, which describes all the our system 
configuration files, their versions, file sizes, success load, 
criticality of a file. Among them may be INFO, WARN or ERROR messages. 
Next example, AAA.BBB.startstop - this logger records only the events of 
launching and unloading the application, so that you can always 
immediately see when and how many times it was overloaded or may be crashed.
I see only the possibility to explicitly assign a binding to these names 
of the appropriate files in the configuration file.  But I wanted to 
configure the configuration file so that it did not have to be changed 
by hand when adding a new logger to the program code. About MDC, I'm not 
too lazy to write MDC calls

But I need every call to the "log.out" method between two MDC.put and 

public class myLog {
   private Logger log;

   public void myLogOut(String msg) {
     MDC.put("logger_id", log.getLoggerName);

but in https://logback.qos.ch/manual/mdc.html  write

"Please note that MDC as implemented by logback-classic assumes that 
values are placed into the MDC with moderate frequency".

>> Logger names are capable to be filtered in hierarchical way. Your
>> thoughts to use them differently are ill minded...Filtering in hierarchical way is very good and useful feature - but now 
it is implenents only "vertical" (level) separation. When I create a 
named Logger object in the program, I already also enclose this 
"horizontal" (logic) separation and I want to use it immediately.

Thanks to Ceki Gulku for explain and example SiftingAppender.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20171018/28ae3ce4/attachment-0001.html>

More information about the logback-user mailing list