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

Add request times to container request logging. #11

Open
Foxcapades opened this issue Feb 17, 2022 · 0 comments
Open

Add request times to container request logging. #11

Foxcapades opened this issue Feb 17, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Foxcapades
Copy link
Member

Foxcapades commented Feb 17, 2022

This is a feature we have in WDK to show how much time has elapsed at log time since the beginning of the request. A jersey filter attaches some information to the request's thread context (Map<String,Object>, which is queried as part of the log line pattern's macro substitution. In Log4j 1.x, the substitution value is the Object.toString() value. So we created an object that retained the request's start time, the in its toString(), calculated the time and returned it.

This method does not work in Log4j2, because, to be more efficient, Log4j2 substitutes the thread context macros only once, then caches them. A solution seemed to be to create a new kind of substitution method (there are many, including date/time, thread context, etc.) and refer to it in the pattern. If we do that, we should be able to substitute with whatever we want.

@ryanrdoherty tried to do this a while back, creating this class in FgpUtil (thinking we would use it in WDK, etc. in the future after we move away from the log4j 1.x APIs). It didn't quite work, but since then, we've modified the way log4j plugins are added to the runtime during the build, so it might be worth trying again.

See this package for both the PatternConverter subclass and the class that handles storing off request information.
https://github.com/VEuPathDB/FgpUtil/tree/master/Core/src/main/java/org/gusdb/fgputil/logging

@Foxcapades Foxcapades added the enhancement New feature or request label Feb 17, 2022
@ryanrdoherty ryanrdoherty self-assigned this Feb 28, 2022
@ryanrdoherty ryanrdoherty removed their assignment May 26, 2022
@steve-fischer-200 steve-fischer-200 self-assigned this Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants