如何在 Apache 2.0 中以毫秒精度对请求日志添加时间戳

发布于 2024-07-09 20:51:06 字数 194 浏览 3 评论 0原文

如何配置 Apache 2.0 的日志格式,以便它以毫秒(或微秒)的精度为每个请求日志添加时间戳? docs 说时间戳是以 strftime 格式指定的,而 strftime 似乎没有处理任何小于秒的事情。

How do I configure Apache 2.0's log format so that it timestamps each request log with millisecond (or microsecond) accuracy? The docs say that timestamps are specified in strftime format and strftime doesn't seem to handle anyting smaller than seconds.

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

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

发布评论

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

评论(2

卷耳 2024-07-16 20:51:06

我认为这是不可能的(至少不重写 APR)。 Apache 使用 apr_strftime。 在 Unix 上,这调用 C 库的 strftime,但甚至不会将毫秒填充到 struct tm 中(这并不奇怪,因为该结构通常首先不支持毫秒)。 Windows 版本没有太大区别。

I don't think it's possible (without rewriting APR, atleast). Apache uses apr_strftime. On Unix, this calls the C library's strftime, but doesn't even fill milliseconds into struct tm (not surprisingly, because this structure doesn't usually support milliseconds in the first place). The Windows versions isn't much different.

绮筵 2024-07-16 20:51:06

使用 %D 选项以获得微秒精度

use %D option for microsecond accuracy

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