Log message structuring after the PSR rewrite in Flow 5.0


(Daniel Lienert) #1

Before Neos 5.0 the log() method of the DefaultLogger which was used as implementation of the SystemLoggerInterface allowed to give a Package-, Class- and Method name as parameters. If non of this data was given, the defaultLogger tried to extract this data from the backtrace.

Well that was not ideal. The package name was kind of redundant with the class name and the the extraction of the class name from the backtrace somehow failed if closures where used.

Today, after the PSR change, the backtrace magic is gone and giving this parameters with every log message is really tedious as it needs now to be given within the additional data array under special keys, which is also marked as legacy in the code.

Having the code location, where the log message was issued in a separate field is always better then including this information unstructured in the log message.

In our projects we heavily rely on the full qualified class name to classify the log messages and to do drill down analysis in kibana.

Sure, I can change the implementation of the Logger class, bring the old behavior back and make classified log message more convenient.

But I wonder, if I am the only one that use that feature and If it wouldn’t be a better Idea to find a solution for that in the core.

Any feedback appreciated.


(Daniel Lienert) #2

Just had a quick call with @christianm and we came to the conclusion that adding some static class and method to help adding the log environment to the message would be a good manual but reliable replacement for the stack-trace magic.

Once this helper methods exist, we need to adjust all log messages send by the core to enrich the log messages with environment data.


(Daniel Lienert) #3

Hey Guys,

The logging-helper is built and a PR is waiting for reviews. If you also rely on structured log messages in your projects, please have a look.