gpt4 book ai didi

log4j - "BufferSize"在 log4j appender 中代表什么?

转载 作者:行者123 更新时间:2023-12-02 00:27:58 25 4
gpt4 key购买 nike

在 org.apache.log4j 中类 AsyncAppender public void setBufferSize(int size)

Sets the number of messages allowed in the event 
buffer before the calling thread is blocked (if blocking is true)
or until messages are summarized and discarded. Changing the size
will not affect messages already in the buffer.

我已经配置了 10,000 个。但是文件在 10K 之后还在继续增长!这是什么原因?

最佳答案

当记录某些内容时,它会添加到内存中的事件缓冲区中。然后将此事件缓冲区中的消息写入磁盘。

如果您记录事物的速度快于它们写入磁盘的速度,事件缓冲区就会填满。在您的情况下,如果事件缓冲区达到 10,000 条消息,日志记录机制将采取措施将其保持在 10,000 条消息或更低:要么阻塞直到缓冲区写入磁盘,要么丢弃日志消息。

关于log4j - "BufferSize"在 log4j appender 中代表什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8136963/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com