When running Console
commands in prod
mode, I need to log Doctrine related debug messages. Everything works fine in dev
with the following configuration, so I assume I forgot something to set when in prod
?
My system:
- PHP 7.3
- Symfony 4.4
- Monolog
- Doctrine
How do I run commands:
I run commands in prod
as either
php bin/console app:scrape --env=prod
or
# set APP_ENV=prod in .env.local before
php bin/console app:scrape
Both result in no logs. I am sure, I run prod
, because Symfony creates var/cache/prod
every time.
Monolog configuration file: config/package/prod/monolog.yaml
This file configures Monolog in prod
environment.
monolog:
handlers:
main:
type: fingers_crossed
action_level: debug
handler: nested
excluded_http_codes: [404, 405]
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
deprecation:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log"
deprecation_filter:
type: filter
handler: deprecation
max_level: info
channels: ["php"]
doctrine:
level: debug
type: stream
path: "%kernel.logs_dir%/doctrine/info.log"
channels: ["doctrine"]
Output of APP_ENV=prod bin/console debug:config monolog:
https://gist.github.com/k00ni/419f62941e496a376be35a0d06e44131
APP_ENV=prod bin/console debug:config monolog
Can you confirm that the doctrine logger is set up correctly? – dbrumanninfo
ordebug
foraction_level: error
inconfig/package/prod/monolog.yaml
. Because actually onlyERROR
logs will be written and if you do not have on your console command, then it will write nothing. – GrenierJdev
, it logs all Doctrine output, so i assume it is set up correctly? – k00nivar/log/prod.deprecation.log
as well as invar/log/doctrine/info.log
. But not my expected Doctrine debug information (like SQLs). – k00ni