GitHub user NicolaIsotta created a discussion: Backport request/session keys of
the Web Lookup (LOG4J2-2523, LOG4J2-2688) to 2.x
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:
- a typed `WebLoggerContextUtils.wrapExecutionContext(ServletRequest,
Runnable)` overload replaces the `log4j.requestExecutor` servlet context
attribute
- a fix for an NPE when a request has no cookies
- `session.*` keys never create a session
The 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?
GitHub link: https://github.com/apache/logging-log4j2/discussions/4486
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]