I am looking to alter the generated output of the log files from the contrib module JsonLog - https://www.drupal.org/project/jsonlog/ The logger generates a .log file, which I need to customize with a few additional fields. Is there a way to alter the data generated by the Logger class? What is the best approach for this? Is extending the Logger within a custom module a good approach?

1 Answer 1


Loggers in Drupal are Symfony services, so the best way to modify this is to decorate the logger.jsonlog service (you need a custom module to this of course). I'd suggest starting with the Symfony docs or google'ing for symfony decorate service to get some code examples.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.