“BufferSize”是什么意思?在 log4j 附加程序中表示?

发布于 2024-12-15 18:53:15 字数 388 浏览 10 评论 0原文

在 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 之后还在继续增长! 原因是什么?

In org.apache.log4j Class 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. 

I have configured 10,000. But the file continues grow also after 10K!
What is the reason?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吃兔兔 2024-12-22 18:53:15

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

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

When something is logged, it is added to the event buffer in memory. Messages in this event buffer are then written to disk.

If you log things faster than they can be written to disk, the event buffer fills up. In your case, if the event buffer reaches 10,000 messages, the logging mechanism takes action to keep it at 10,000 messages or lower: either blocking until the buffer is written to disk, or throwing away log messages.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文