The commands will always stderr by default (if you specify the -vvv option)
If you need to write the logs in a file only on error (with the stack error) you can use the finger_crossed handler :
handlers:
main:
# fingers_crossed allow to log only if action_level defined is reach
type: fingers_crossed
# minimum level to activate the handler
# available level (emergency|alert|critical|error|warning|notice|info|debug){1}
action_level: error
# wrapped handler's name
handler: nested
nested:
# stream allow to write log in file
type: stream
# path to the log file
path: "%kernel.logs_dir%/%project_name%_%kernel.environment%.log"
# available level (emergency|alert|critical|error|warning|notice|info|debug){1}
level: debug
If you want to filter a bit the logs shown in the stderr you can use the default config for the console :
console:
type: console
process_psr_3_messages: false
channels: ['!event', '!doctrine', '!console']
I'll allow you to have nicer console logs (and avoid too many "useless" logs such as event or doctrine which are very verbose)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…