Wrap Log4j 1.x MDC.put values in String.valueOf(...)
MSALSLF4J MDC.put(String, String) requires a String value, but Log4j 1.x MDC.put(String, Object) accepts any object. Wrap non-String values in String.valueOf(...), skipping values already typed String, null literals, and existing String.valueOf(...) calls. Does not change the org.apache.log4j.MDC type; compose with a ChangeType to complete the migration to org.slf4j.MDC.
org. openrewrite. java. logging. slf4j. WrapLog4j1MdcPutValueInStringValueOfmod run . --recipe= org. openrewrite. java. logging. slf4j. WrapLog4j1MdcPutValueInStringValueOfInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.