如何进行logback&#39"审慎模式"实施的? [英] How is logback's "prudent mode" implemented?
问题描述
logback中的谨慎模式可以序列化所有JVM写入的JVM之间的IO操作.同一文件,可能在不同的主机上运行.在其他日志记录框架中,如果许多记录器的输出都应转到同一文件,则记录到中央TCP(或JMS)附加器似乎是唯一的解决方案.
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.
由于我使用的是基于log4j的Delphi库,并且无法从同一应用程序的不同实例(在终端服务器上)登录到同一文件,因此了解如何实现此功能将很有趣.-附言我会检查 logback 源代码,如果没有人更快,我会回来回答我的问题:)
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 :)
推荐答案
使用简单的 FileAppender .
It's implemented with a simple FileLock. You can check in the source of FileAppender.
这篇关于如何进行logback&#39"审慎模式"实施的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!