“BufferSize”是什么意思?在 log4j 附加程序中表示?
在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当记录某些内容时,它会被添加到内存中的事件缓冲区中。然后,该事件缓冲区中的消息将写入磁盘。
如果您记录的速度比写入磁盘的速度快,事件缓冲区就会填满。在您的情况下,如果事件缓冲区达到 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.