Symfony not showing PDO exceptions in production log

If my application has no connection to the database (postgres), it ends with the default error page showing the infamous error in prod-mode:

Oops! An Error Occurred
The server returned a "500 Internal Server Error".

In dev mode I see the error:

PDOException > Exception  > ConnectionException
An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused

These causes are not displayed in the logs. Neither server nor php logs. The only thing I see there is

172.19.0.1 - - [30/Oct/2020:09:58:25 +0000] "GET / HTTP/1.1" 500 831

This is my monolog configuration:

monolog:
  handlers:
    main:
     type: fingers_crossed
     action_level: debug
     handler: nested

  nested:
     type: stream
     path: php://stdout
     level: debug

Btw, I’m logging everything to stdout.

So, how do I get these errors to the log?

(Symfony 5.1, docker, apache2)

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *