How is logback's “prudent mode” implemented?

*爱你&永不变心* 提交于 2020-01-04 12:18:01

问题


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:


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



来源:https://stackoverflow.com/questions/7138838/how-is-logbacks-prudent-mode-implemented

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!