[logback-user] Create a new log file only if the default one is open

Thorsten Schöning tschoening at am-soft.de
Sat Oct 10 17:47:15 CEST 2020

Guten Tag Olivier Cailloux,
am Samstag, 10. Oktober 2020 um 15:57 schrieben Sie:

> It is possible to detect (at least under Linux, but, I suppose, in
> other OSes as well) that a process has a file open, so this seems
> feasible, at least in principle; and it seems like a natural
> requirement for programs designed to allow parallel instances. I am
> surprised I didn’t see anything related to this in the logback manual.
> Is there a reason not to want what I want?

Many users most likely simply prefer to have one known schema of log
file names, like a static name in your case, the current month and
year etc. Many apps supporting concurrency in general, which is not
only multiple processes, but threads as well, use Nested Diagnostic
Context instead to provide IDs/names of processes or threads WITHIN
one and the same log file. Many tools processing those log files are
prepared to support that and allow e.g. filtering based on that
additional data. Sometimes it's even necessary to log that way to see
e.g. when multiple instances block each other using their log
timestmap or something like that.

So while you should be able to implement an appender doing what you
like yourself, from my experience most people simply prefer to do it
differently and therefore there might simply be no built-in solution
available yet.

Mit freundlichen Grüßen,

Thorsten Schöning

Thorsten Schöning       E-Mail: Thorsten.Schoening at AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

More information about the logback-user mailing list