How is logback's “prudent mode” implemented?

2019-07-14 13:48发布

The prudent mode in logback serializes IO operations between all JVMs writing to the same file, potentially running on different hosts. In other logging frameworks, logging to a central TCP (or JMS) appender seems to be the only solution if output from many loggers should go to the same file.

As I am using a Delphi library which is based on log4j and also can not log to the same file from different instances of the same applications (on a terminal server), it would be interesting to know how this feature is implemented. - p.s. I'll check the logback source code and come back to answer my question if nobody is faster :)

1条回答
该账号已被封号
2楼-- · 2019-07-14 14:31

It's implemented with a simple FileLock. You can check in the source of FileAppender.

查看更多
登录 后发表回答