Tomcat HTTP Access日志在写入文件时有延迟 [英] Tomcat HTTP Access log has a delay in writing to the file

查看:278
本文介绍了Tomcat HTTP Access日志在写入文件时有延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在tomcat中,http访问日志阀需要一些时间才能写入文件.请注意,我具有org.apache.catalina.valves.AccessLogValve的默认配置.无论如何,有没有改善延迟的方法?造成这种延迟的主要原因是什么

In tomcat http access log valve takes some time to write to file. Please note I have default configurations for org.apache.catalina.valves.AccessLogValve. Are there anyways to improve the latency? And what are the key reasons for this delay

推荐答案

我找到了答案. 您可以通过禁用缓冲来改善延迟.标志缓冲"确定日志记录是否将被缓冲.如果设置为false,则将在每个请求之后写入访问日志.默认值:true.因此,添加BufferedLogs ="false"将减少写入日志文件的延迟.另一个属性是backgroundProcessorDelay.如果未指定,则此属性的默认值为10,表示10秒的延迟. 因此,通过将其设置为较低的值,可以改善将http访问日志写入文件的延迟.

I found the answer for this. You can improve the delay by disabling buffering. Flag "buffered" determine if logging will be buffered. If set to false, then access logging will be written after each request. Default value: true. Therefore, adding BufferedLogs="false" will reduce the delay in writing to the log file. Another property is backgroundProcessorDelay. If not specified, the default value for this attribute is 10, which represent a 10 seconds delay. Therefore, by setting it to a lower value you can improve the delay writing http-access logs to a file.

这篇关于Tomcat HTTP Access日志在写入文件时有延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆