I am using Symfony "symfony/symfony": "2.6.*",
.and Mono log to track all logs.
Log will write only when enabling true in app.php
$kernel = new AppKernel('prod',true);
My problem is if I enable to true then the user can see error exception.Can anyone help me how I can achieve to write log when enabling to false in App kernel.
Ref: Symfony doesn't create logs in production environment
Updated Config_prod
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
nested:
type: stream
path: "php://stderr"
level: debug
You should let new AppKernel('prod', false);
You are looking in the wrong folder. Your configuration is writing log in the general php error log
path: "php://stderr"
Change your config_prod.yml
to :
monolog:
handlers:
# [...]
nested:
type: stream
path: %kernel.logs_dir%/%kernel.environment%.log
level: debug
Don't forget to clear the cache with --env=prod