Created
June 2, 2017 08:47
-
-
Save janstoeckler/7f251bf10fedbfb7f752b61ee5d2ef5e to your computer and use it in GitHub Desktop.
Drupal 8 monolog logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parameters: | |
... | |
monolog.channel_handlers: | |
# Log to a file by default. | |
default: ['file'] | |
# Send the php channel to web server's error log and the browser console: | |
# php: ['error_log', 'browser_console'] | |
# Ignore log entries of "content" channel. | |
# content: ['null'] | |
# Show memory usage on each log entry: | |
monolog.processors: ['message_placeholder', 'current_user', 'request_uri', 'memory_usage', 'web'] | |
services: | |
# Monolog handlers. | |
monolog.handler.file: | |
class: Monolog\Handler\RotatingFileHandler | |
arguments: ['../logs/application.log', '30', '200', false] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install Drupal 8 monolog module
composer require drupal/monolog
Enable monolog module
Add this snippet (except the first 4 lines) to sites/default/services.yml, you can also customize it to use different monolog processors & handlers as you desire
Uninstall watchdog module as it will no longer work