Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application uptime placeholder #129

Closed
dzikoysk opened this issue Jan 1, 2020 · 6 comments
Closed

Application uptime placeholder #129

dzikoysk opened this issue Jan 1, 2020 · 6 comments
Assignees
Milestone

Comments

@dzikoysk
Copy link

dzikoysk commented Jan 1, 2020

It could be great to have a placeholder that represents the current uptime of application, e.g. {uptime}. The init time may be the same as the logger initialization time.

Even if you don't like this proposal, it might be solved by the posiblity of being able to register custom placeholder.

@pmwmedia
Copy link
Member

pmwmedia commented Jan 1, 2020

A pull request for an {uptime} placeholder is welcome :-) I think the up time placeholder could be formatted via the same format pattern syntax as the existing {date} placeholder.

@pmwmedia
Copy link
Member

pmwmedia commented Jan 1, 2020

API for plain Java:
java.lang.management.ManagementFactory.getRuntimeMXBean().getUptime()

API for Android:
android.os.SystemClock.uptimeMillis()

@dzikoysk
Copy link
Author

dzikoysk commented Jan 1, 2020

Yeah, I was thinking about ManagementFactory, but it also counts JVM startup time. On the other hand maybe it could be better to separate relative uptime for each logger instance 🤔

{uptime} - ManagementFactory/SystemClock
{relative-uptime} - initialized when logger is created

The first one is obvious, but in fact, the second one is much more useful.

@pmwmedia
Copy link
Member

pmwmedia commented Jan 2, 2020

The use case for JVM up time is obvious for me. However, what is the use case for logger instances up times?

@pmwmedia pmwmedia added this to the 2.2 milestone Jan 13, 2020
@pmwmedia pmwmedia self-assigned this Jul 15, 2020
pmwmedia added a commit that referenced this issue Jul 15, 2020
@dzikoysk
Copy link
Author

dzikoysk commented Aug 8, 2020

Oh, I had to miss the notification about your response, sorry, I have a lot of them. Anyway, thanks for the implementation ❤️

@github-actions
Copy link

github-actions bot commented Oct 9, 2022

This closed issue has been locked automatically. However, please feel free to file a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants