weblogic log4j 日志中的时间不正确

发布于 2024-10-08 23:25:44 字数 829 浏览 0 评论 0原文

我们的 weblogic 应用程序服务器在 unix 机器上运行,我们的应用程序使用为 DailyRollingFileAppender 配置的 log4j。

当我在 unix 提示符下尝试“date”命令时,它显示了正确的时区(我位于太平洋时区),但同时在日志文件中我可以看到提前一小时的时间。

例如,日期命令显示“Mon Dec 20 15:10:39 PST 2010”,但如果我打开日志文件,我可以看到 20-Dec-2010 16:10:39,773 DEBUG XYZ ....

我的log4j设置

log4j.appender.test=org.apache.log4j.DailyRollingFileAppender
log4j.appender.test.DatePattern='.'yyyy-MM-dd
log4j.appender.test.Threshold=DEBUG
log4j.appender.test.ImmediateFlush=true
log4j.appender.test.File=test.log
log4j.appender.test.Append=true
log4j.appender.test.layout=org.apache.log4j.PatternLayout
log4j.appender.test.layout.ConversionPattern=%d{dd-MMM-yyyy HH:mm:ss,SSS} %-5p %C:%L - %m%n

不确定unix时间是否正确(太平洋标准时间)log4j用于记录的时间,我在上述设置中没有看到任何log4j时区配置。

如何检查 weblogic 中时区设置不正确的地方?

-鲁希克。

We have weblogic appserver running on unix box with our application which uses log4j configured for DailyRollingFileAppender.

When I try "date" command on unix prompt it shows me correct timezone (I am in pacific timezone) but for the same time in log files I can see one hour ahead time.

Like, date command shows "Mon Dec 20 15:10:39 PST 2010" but if I open log file, I can see
20-Dec-2010 16:10:39,773 DEBUG XYZ....

My log4j settings are

log4j.appender.test=org.apache.log4j.DailyRollingFileAppender
log4j.appender.test.DatePattern='.'yyyy-MM-dd
log4j.appender.test.Threshold=DEBUG
log4j.appender.test.ImmediateFlush=true
log4j.appender.test.File=test.log
log4j.appender.test.Append=true
log4j.appender.test.layout=org.apache.log4j.PatternLayout
log4j.appender.test.layout.ConversionPattern=%d{dd-MMM-yyyy HH:mm:ss,SSS} %-5p %C:%L - %m%n

Not sure if unix time is proper PST time what time log4j is using for logging, I dont see any log4j timezone configuration in above settings.

How can I check where my timezone settings are incorrect in weblogic ?

-Rushik.

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

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

发布评论

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

评论(2

栀梦 2024-10-15 23:25:44

我刚刚在ubuntu上解决了这个问题,步骤如下
1.使用tzselect命令配置时区
2.ln -sf /usr/share/zoneinfo/$State/$city /etc/localtime
3.确保您配置的“/etc/timezone”设置时区
4.重启

i just solved this problem on ubuntu,here are the steps
1.use tzselect command confiugre timezone
2.ln -sf /usr/share/zoneinfo/$State/$city /etc/localtime
3.ensure that the "/ etc/timezone" which is you configured to set the timezone
4.reboot

Saygoodbye 2024-10-15 23:25:44

听起来您的问题与夏令时 (DST) 有关。如果重新启动应用程序服务器无法解决问题,则您可能使用的是较旧版本的 java,该版本没有针对最近的 DST 更改进行修复。

如果是这种情况,您可以选择更新到嵌入了修复程序的更高版本的 JDK,或者可以手动将 DST 补丁应用到现有的 Java 安装。

It sounds like your issue is with Daylight Savings Time (DST). If a restart of your application server does not resolve the issue, you may be using an older version of java that does not have the fix for the recent DST change.

If that is the case, you have the option of either updating to a later JDK that has the fix embedded or you could manually apply the DST patch to your existing Java installation.

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