You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "AnushaGHerale (via GitHub)" <gi...@apache.org> on 2024/01/05 08:29:14 UTC
[I] %d{UNIX_MILLIS} is printing 0 as timestamp in log file (logging-log4j2)
AnushaGHerale opened a new issue, #2167:
URL: https://github.com/apache/logging-log4j2/issues/2167
## Description
We have upgrade from log4j1.x to log4j2.18.
After this upgrade in our log file we are seeing few log statement are recoded with correct system time . But few are logging with epho default time i.e "1/1/1970" . To check more on in log4j2.xml file we changed the patternlayout to %d{UNIX_MILLIS} in this we are seeing few are printing 0 and few log statement with correct time in milliseconds from epoch.
## Configuration
Please attachment.
**Version:** 2.18.0
**Operating system:** Linux ocsg001 4.14.35-2047.524.5.el7uek.x86_64 #2 SMP Wed Mar 29 15:42:02 PDT 2023 x86_64 x86_64 x86_64 GNU/Linux
**JDK:** java version "1.8.0_311"
Java(TM) SE Runtime Environment (build 1.8.0_311-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.311-b25, mixed mode)
## Logs
Please attachment
```
[Stacktraces, errors, etc. relevant applications logs.]
```We have enable the debug flag while starting the server. Here is the log4j logs.
[Uploading default.log…]()
[Log4j2.18DebugLogs.txt](https://github.com/apache/logging-log4j2/files/13839686/Log4j2.18DebugLogs.txt)
[log4j2config.txt](https://github.com/apache/logging-log4j2/files/13839690/log4j2config.txt)
## Reproduction
[An isolated test reproducing the test.
JUnit tests similar to the ones in the code base are extremely appreciated.]
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] %d{UNIX_MILLIS} is printing 0 as timestamp in log file (logging-log4j2)
Posted by "jvz (via GitHub)" <gi...@apache.org>.
jvz commented on issue #2167:
URL: https://github.com/apache/logging-log4j2/issues/2167#issuecomment-1879182380
Looking at your log file, I see that some debug logs do indeed have the unix milliseconds timestamp, but others don't, and that seems odd. The use of `%F` is also a little concerning; I'd typically use `%c`/`%logger` instead since that doesn't involve any stack walking to find the location info about the calling code.
One thing that may be an issue here is that you're using `CachedClock` instead of the default `SystemClock`. The cached clock uses a background thread to update the time once every millisecond (which sort of relies on the underlying OS scheduler to support timers with a granularity that small; some OSes will only go as low as 10 ms or 16ms or somewhere around there) while the system clock just invokes `System::currentTimeMillis` every time. Since this log file is for debug logs, it might be that the log messages are being logged faster than the cached clock is updating itself, but then I'd expect the results to be the same timestamp being used (and not 0).
Another thing is that you're using a custom `LoggerContext`, though I'm not sure if that's causing any problems.
Do you still have this same problem with version 2.22.1?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] %d{UNIX_MILLIS} is printing 0 as timestamp in log file (logging-log4j2)
Posted by "AnushaGHerale (via GitHub)" <gi...@apache.org>.
AnushaGHerale commented on issue #2167:
URL: https://github.com/apache/logging-log4j2/issues/2167#issuecomment-1878331502
[default.log](https://github.com/apache/logging-log4j2/files/13839902/default.log)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] %d{UNIX_MILLIS} is printing 0 as timestamp in log file (logging-log4j2)
Posted by "AnushaGHerale (via GitHub)" <gi...@apache.org>.
AnushaGHerale commented on issue #2167:
URL: https://github.com/apache/logging-log4j2/issues/2167#issuecomment-1879705855
Hi Matt Sicker,
Thanks for the response.
I tried with the 2.22.0 version, Still, the issue persists. Regarding
the "CachedClock,"
this was configured just to check if the issue persists with the clock
manual setting. Otherwise, by default, we use SystemClock. As we have not
mentioned any clock.
I will test with 2.22.1 and get back to you.
Why do you think, custom LoggerContext can cause some problems?
Thanks & Regards
Anusha
On Sat, Jan 6, 2024 at 1:19 AM Matt Sicker ***@***.***> wrote:
> Looking at your log file, I see that some debug logs do indeed have the
> unix milliseconds timestamp, but others don't, and that seems odd. The use
> of %F is also a little concerning; I'd typically use %c/%logger instead
> since that doesn't involve any stack walking to find the location info
> about the calling code.
>
> One thing that may be an issue here is that you're using CachedClock
> instead of the default SystemClock. The cached clock uses a background
> thread to update the time once every millisecond (which sort of relies on
> the underlying OS scheduler to support timers with a granularity that
> small; some OSes will only go as low as 10 ms or 16ms or somewhere around
> there) while the system clock just invokes System::currentTimeMillis
> every time. Since this log file is for debug logs, it might be that the log
> messages are being logged faster than the cached clock is updating itself,
> but then I'd expect the results to be the same timestamp being used (and
> not 0).
>
> Another thing is that you're using a custom LoggerContext, though I'm not
> sure if that's causing any problems.
>
> Do you still have this same problem with version 2.22.1?
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/logging-log4j2/issues/2167#issuecomment-1879182380>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AXAL7TR3RIJ4CPZCDRLFMF3YNBKN5AVCNFSM6AAAAABBOCW4DKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZZGE4DEMZYGA>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] %d{UNIX_MILLIS} is printing 0 as timestamp in log file (logging-log4j2)
Posted by "jvz (via GitHub)" <gi...@apache.org>.
jvz commented on issue #2167:
URL: https://github.com/apache/logging-log4j2/issues/2167#issuecomment-1879801007
I don't think it should cause problems, but it was one of the few things I noticed in the debug logs that differs from a plain setup.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] %d{UNIX_MILLIS} is printing 0 as timestamp in log file (logging-log4j2)
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #2167: %d{UNIX_MILLIS} is printing 0 as timestamp in log file
URL: https://github.com/apache/logging-log4j2/issues/2167
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] %d{UNIX_MILLIS} is printing 0 as timestamp in log file (logging-log4j2)
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #2167:
URL: https://github.com/apache/logging-log4j2/issues/2167#issuecomment-2087853684
This issue is stale because it has been waiting for your feedback for more than 60 days. The Apache Logging Services community values every submitted issue, but without additional information from you, we are unable to provide a solution to your problem.
Please comment on this issue or it will be closed in 7 days.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] %d{UNIX_MILLIS} is printing 0 as timestamp in log file (logging-log4j2)
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on issue #2167:
URL: https://github.com/apache/logging-log4j2/issues/2167#issuecomment-1879352574
@AnushaGHerale, thanks so much for the report. We would really appreciate it if you can share a very very minimal example that we can use to reproduce the issue ourselves. That is, a `pom.xml`, a `log4j2.xml`, and a `Main.java`. Please avoid sharing any extra logic, dependency, code, configuration, etc. that are irrelevant to do the issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] %d{UNIX_MILLIS} is printing 0 as timestamp in log file (logging-log4j2)
Posted by "AnushaGHerale (via GitHub)" <gi...@apache.org>.
AnushaGHerale commented on issue #2167:
URL: https://github.com/apache/logging-log4j2/issues/2167#issuecomment-1879699395
Hi,
i will try to share with you soon. Thanks a response.
On Sat, Jan 6, 2024 at 4:21 AM Volkan Yazıcı ***@***.***>
wrote:
> @AnushaGHerale <https://github.com/AnushaGHerale>, thanks so much for the
> report. We would really appreciate it if you can share a very very minimal
> example that we can use to reproduce the issue ourselves. That is, a
> pom.xml, a log4j2.xml, and a Main.java. Please avoid sharing any extra
> logic, dependency, code, configuration, etc. that are irrelevant to do the
> issue.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/logging-log4j2/issues/2167#issuecomment-1879352574>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AXAL7TWIGE3WEMJLJHLO563YNB7YFAVCNFSM6AAAAABBOCW4DKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZZGM2TENJXGQ>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org