Specify formatter
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3019715. --> Reported by: [legovaer](https://www.drupal.org/user/1327142) >>> <p>One of the powerful capabilities of monolog is to specify the formatter that should be used. This functionality is still lacking in this module.</p> <p>I changed the MonologLoggerChannelFactory in a way that it allows users to add a formatter to their services.yml file:</p> <pre>parameters:<br>&nbsp; http.response.debug_cacheability_headers: true<br>&nbsp; monolog.channel_handlers:<br>&nbsp;&nbsp;&nbsp; # Log to the syslog by default.<br>&nbsp;&nbsp;&nbsp; default: ['stream_handler']<br>&nbsp;&nbsp;&nbsp; # Send the php channel to web server's error log and the browser console:<br>&nbsp;&nbsp;&nbsp; php: ['error_log', 'browser_console']<br>&nbsp;&nbsp;&nbsp; # Ignore log entries of "content" channel.<br>&nbsp;&nbsp;&nbsp; content: ['null']<br>&nbsp;&nbsp;&nbsp; formatter: 'logstash'<br><br>services:<br>&nbsp; cache.backend.null:<br>&nbsp;&nbsp;&nbsp; class: Drupal\Core\Cache\NullBackendFactory<br>&nbsp; monolog.handler.stream_handler:<br>&nbsp;&nbsp;&nbsp; class: Monolog\Handler\StreamHandler<br>&nbsp;&nbsp;&nbsp; # Set alert as the minimum level (ignores emergency) and disable bubbling for this Handler<br>&nbsp;&nbsp;&nbsp; arguments: ['/app/logs/test.log']<br>&nbsp; monolog.formatter.logstash:<br>&nbsp;&nbsp;&nbsp; class: Monolog\Formatter\LogstashFormatter<br>&nbsp;&nbsp;&nbsp; arguments: ['test']</pre>
issue