Log errors
Log errors can be really useful when your website is online to not show errors to the client or to simply log when you develop a theme or plugin.
Parvula suggest Seldaek/Monolog to log what you want.
Use monolog
- Firstly install Monolog 
composer require monolog/monolog - If you want to log error and exception, enable the log 
logErrors: truein system.yaml - It is recommended to disable the debug because Whoops block the current exception and throw a new exception. 
debug: truein system.yaml 
To log what you want, use the service registered as ‘logger’ in the router ($this->logger).
A basic example could be:
$this->logger->addError('Hello world');