Repository navigation
Backport request/session keys of the Web Lookup (LOG4J2-2523, LOG4J2-2688) to 2.x #4486
NicolaIsotta
started this conversation in
General
Replies: 1 comment
|
@NicolaIsotta thanks for this, and yes, please open the PR on The only reason it stayed out of 2.x was the lambdas, and the keys are already in 3.x in Two asks: keep the key names exactly as in |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
In 2019, #246 (LOG4J2-2523) and #287 (LOG4J2-2688) added HTTP request and session keys to the web lookup, such as
${web:header.X-Correlation-Id},${web:request.uri}and${web:session.attr.user}. They were merged to master (3.x) only. According to the LOG4J2-2523 comments, the reason was that the patch used lambdas, which release-2.x didn’t allow at the time. log4j-web is no longer in main, so these keys are currently not available in any release.I have a backport ready for log4j-web and log4j-jakarta-web on 2.x, with tests, docs and a changelog entry. It mostly follows the original PRs, with these changes:
WebLoggerContextUtils.wrapExecutionContext(ServletRequest, Runnable)overload replaces thelog4j.requestExecutorservlet context attributesession.*keys never create a sessionThe docs note that header, cookie and parameter values come from the HTTP client and are untrusted.
Would you accept a PR for this on 2.x?
All reactions