logback'的 "谨慎模式 "是如何实现的?[英] How is logback's "prudent mode" implemented?

本文是小编为大家收集整理的关于logback'的 "谨慎模式 "是如何实现的?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

prudent Mode 在logback中相同的文件,有可能在不同主机上运行.在其他日志记录框架中,如果从许多日志记录器中输出的输出,则登录到中央TCP(或JMS)Appender似乎是唯一的解决方案.

我使用的是基于log4j的Delphi库,也无法从相同应用程序的不同实例(在终端服务器上)登录相同的文件,因此知道如何实现此功能会很有趣. - P.S.如果没有人更快,我将检查记录源代码,然后回答我的问题:)

推荐答案

它是用简单的 Filelock .您可以在 fileappender .

本文地址:https://www.itbaoku.cn/post/1575041.html

问题描述

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 :)

推荐答案

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