2015-07-24 00:53:41 +02:00
|
|
|
---
|
|
|
|
Name: logging
|
|
|
|
---
|
2018-07-04 01:55:54 +02:00
|
|
|
# Core error logging is built up of a chain containing:
|
2017-05-11 07:38:29 +02:00
|
|
|
# - A top level \ErrorHandler which registers the error service
|
|
|
|
# - A \Logger which acts as the error service
|
|
|
|
# - A \HandlerInterface which handles errors for the logger
|
|
|
|
# - One or more \FormatterInterface which format errors for the handler
|
2018-07-04 01:55:54 +02:00
|
|
|
#
|
|
|
|
# Logging for use outside of core error handling also uses the same implementations,
|
|
|
|
# but is available without the HandlerInterfaces attached
|
2016-08-19 00:51:35 +02:00
|
|
|
SilverStripe\Core\Injector\Injector:
|
2017-05-11 07:38:29 +02:00
|
|
|
SilverStripe\Logging\ErrorHandler:
|
2016-08-19 00:51:35 +02:00
|
|
|
class: SilverStripe\Logging\MonologErrorHandler
|
2018-07-04 01:55:54 +02:00
|
|
|
calls:
|
2018-07-04 02:11:56 +02:00
|
|
|
pushDefaultLogger: [ pushLogger, [ '%$Psr\Log\LoggerInterface' ] ]
|
|
|
|
pushErrorHandler: [ pushLogger, [ '%$Psr\Log\LoggerInterface.errorhandler' ] ]
|
2018-07-04 01:55:54 +02:00
|
|
|
|
|
|
|
# Default implementation for use as a standard logger. Up to developers to attach their own
|
|
|
|
# handlers
|
2017-03-09 23:20:58 +01:00
|
|
|
Psr\Log\LoggerInterface:
|
2015-07-24 00:53:41 +02:00
|
|
|
type: singleton
|
|
|
|
class: Monolog\Logger
|
|
|
|
constructor:
|
|
|
|
- "error-log"
|
2018-07-04 01:55:54 +02:00
|
|
|
# Core error handling
|
|
|
|
Psr\Log\LoggerInterface.errorhandler:
|
|
|
|
type: singleton
|
|
|
|
class: Monolog\Logger
|
|
|
|
constructor:
|
|
|
|
- "error-handler"
|
2015-07-24 00:53:41 +02:00
|
|
|
calls:
|
2017-07-21 12:17:18 +02:00
|
|
|
pushDisplayErrorHandler: [ pushHandler, [ '%$Monolog\Handler\HandlerInterface' ] ]
|
2017-05-11 07:38:29 +02:00
|
|
|
---
|
|
|
|
Name: loggingformatters
|
|
|
|
---
|
|
|
|
SilverStripe\Core\Injector\Injector:
|
|
|
|
# Display detailed information on an error
|
|
|
|
Monolog\Formatter\FormatterInterface.detailed:
|
|
|
|
class: SilverStripe\Logging\DetailedErrorFormatter
|
|
|
|
# Display friendly error messages and suppresses possible disclosure of dev configuration
|
|
|
|
Monolog\Formatter\FormatterInterface.friendly:
|
|
|
|
class: SilverStripe\Logging\DebugViewFriendlyErrorFormatter
|
|
|
|
properties:
|
|
|
|
Title: "There has been an error"
|
|
|
|
Body: "The website server has not been able to respond to your request"
|
2015-07-24 00:53:41 +02:00
|
|
|
---
|
|
|
|
Name: dev-logging
|
|
|
|
Only:
|
|
|
|
environment: dev
|
|
|
|
---
|
2017-05-11 07:38:29 +02:00
|
|
|
# Dev handler outputs detailed information including notices
|
2016-08-19 00:51:35 +02:00
|
|
|
SilverStripe\Core\Injector\Injector:
|
2017-05-11 07:38:29 +02:00
|
|
|
Monolog\Handler\HandlerInterface:
|
2016-08-19 00:51:35 +02:00
|
|
|
class: SilverStripe\Logging\HTTPOutputHandler
|
2015-07-24 00:53:41 +02:00
|
|
|
constructor:
|
|
|
|
- "notice"
|
|
|
|
properties:
|
2017-07-21 12:17:18 +02:00
|
|
|
DefaultFormatter: '%$Monolog\Formatter\FormatterInterface.detailed'
|
2015-07-24 00:53:41 +02:00
|
|
|
---
|
|
|
|
Name: live-logging
|
|
|
|
Except:
|
|
|
|
environment: dev
|
|
|
|
---
|
2017-05-11 07:38:29 +02:00
|
|
|
# Live handler outputs user-friendly error details, and ignores notices
|
|
|
|
# CLI errors still show full details
|
2016-08-19 00:51:35 +02:00
|
|
|
SilverStripe\Core\Injector\Injector:
|
2017-05-11 07:38:29 +02:00
|
|
|
Monolog\Handler\HandlerInterface:
|
2016-08-19 00:51:35 +02:00
|
|
|
class: SilverStripe\Logging\HTTPOutputHandler
|
2015-07-24 00:53:41 +02:00
|
|
|
constructor:
|
|
|
|
- "error"
|
|
|
|
properties:
|
2017-07-21 12:17:18 +02:00
|
|
|
DefaultFormatter: '%$Monolog\Formatter\FormatterInterface.friendly'
|
|
|
|
CLIFormatter: '%$Monolog\Formatter\FormatterInterface.detailed'
|