Object and method tracking in logging with Java 11
The% O {1}.% M sequence in Monolog patterns is used to display the class of the object, the method and the line number corresponding to the error. This trace is expensive but allows precise tracking of traces regardless of the quality of the message.
It seems that this pattern no longer works with Java 11 (it works in Java 8), the displayed trace always referring to Logger.log. The problem may come from a change in the structure of the stacktraces used to retrieve information.
It seems that this pattern works for the JoramMQ tty handler in Java 8 and 11. This behavior is due to the fact that the console handler of the JavaLog wrapper is directly implemented by Monolog.
File type handlers are implemented through the GenericHandler class by wrapping the JavaLog FileHandler. This handler uses a monolog Formatter which manipulates the stack to find the elements corresponding to% O and% M. The code goes up the stack by filtering predefined method patterns. It is likely that the Java 11 implementation of JavaLog uses an unintended package.
The Monolog project is no longer maintained, the solution is to replace Monolog with a minimal wrapper to JavaLog.
See (JoramMQ #266).