Jorge Diaz 2 Years Ago In https://issues.liferay.com/browse/LPS-145235 it seems Liferay is going to set some information in the MDC context. See code changes https://github.com/liferay-core-infra/liferay-portal/pull/322/files Please sign in to reply. Reply as... Cancel
Aldo De Vleeschauwer 2 Years Ago - Edited Very interesting. We recently used MDC to push information via a logging agent to OpenTelemetry. At the time I found your article on slf4j (https://liferay.dev/blogs/-/blogs/liferay-logging-is-dead-long-live-liferay-logging-) and we used the slf4j API to push the MDC. Here you are using ThreadContext, so directly calling the log4j2 API. What is the vision of Liferay on logging ? Use slf4j or use the Liferay logging APIs ? The latter still don't support parametrized log messages. Please sign in to reply. Reply as... Cancel David H Nebinger Aldo De Vleeschauwer 2 Years Ago - Edited True enough... When I'm coding, I continue to use slf4j for logging, this still works even under Liferay's change to Log4j2. However, for this MDC/NDC blog, I was trying to avoid forcing the use of slf4j and kept to the pure Log4j2 approach. I wanted to focus more on the log4j2 configuration and usage and not get stuck in a battle over which log framework is better. That said, I would continue using slf4j even for my own MDC/NDC needs, especially because it supports the parameterized log messages, a handy optimization indeed. Please sign in to reply. Reply as... Cancel
David H Nebinger Aldo De Vleeschauwer 2 Years Ago - Edited True enough... When I'm coding, I continue to use slf4j for logging, this still works even under Liferay's change to Log4j2. However, for this MDC/NDC blog, I was trying to avoid forcing the use of slf4j and kept to the pure Log4j2 approach. I wanted to focus more on the log4j2 configuration and usage and not get stuck in a battle over which log framework is better. That said, I would continue using slf4j even for my own MDC/NDC needs, especially because it supports the parameterized log messages, a handy optimization indeed. Please sign in to reply. Reply as... Cancel