如何让 NCSARequestLog 每小时滚动一次?

发布于 2024-11-26 18:43:52 字数 188 浏览 2 评论 0 原文

Jetty 提供 NCSARequestLog 来记录请求。但这似乎默认每天都会滚动。

是否可以选择按小时进行滚动?

或者有没有办法为此提供自定义日志附加程序?

Jetty provides the NCSARequestLog to log the requests. But this seems to rollover on a daily basis by default.

Is there an option to have this rollover on an hourly basis?

Or is there a way to provide a custom log appender for this?

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

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

发布评论

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

评论(1

爱格式化 2024-12-03 18:43:53

我不是 100% 确定您的滚动到底是什么意思,但我看到有两件事值得尝试:

  1. 查看 retainDays 设置,以定义何时可以删除旧日志。 wiki.eclipse.org/Jetty/Howto/Configure_Request_Logs

  2. 请设置文件名 将文件名模板设置为特定于时间的内容:


    <文件名>target/yyyy_mm_dd_hh.request.log
    10
    <附加>true
    <扩展>真
    GMT+1

如果这有效,请反馈,因为我没有明确尝试过。

I am not 100% sure what exactly you mean with rollover, but I see two things worth trying:

  1. Look at the retainDays setting, to define when old logs may be delted. wiki.eclipse.org/Jetty/Howto/Configure_Request_Logs

  2. Tyr to set the filename template to something that is hour-specific:

<requestLog implementation="org.mortbay.jetty.server.NCSARequestLog">
    <filename>target/yyyy_mm_dd_hh.request.log</filename>
    <retainDays>10</retainDays>
    <append>true</append>
    <extended>true</extended>
    <logTimeZone>GMT+1</logTimeZone>
</requestLog>

Please feedback, if this works, since I didn't explicitly try it.

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