Yii2: yii/db/Command#execute outputs all SQL queries at INFO log level

Created on 27 Dec 2013  路  5Comments  路  Source: yiisoft/yii2

Is this by design? This fills up the default log pretty quickly and also messes the view due to new line breakers that might exist in the query itself.

You might have been encouraging users to configure their own logs to app-specific stuff leaving the default "app" log for Yii-specific stuff, but in my mind it would be better to have DEBUG log level specified by default

All 5 comments

Yes, this is by design. Even in production, you may want to log all SQLs. If you don't need it in log targets, just filter them out through log categories.

INFO level purposed for regular messages of program workflow for regular peoples. SQL and other technical dumps should be in DEBUG/TRACE level.

Filtering out yii\db category is not a solution because a don't want to filter warning/errors from it. That is not a right way!

You can disable it via this flag: https://www.yiiframework.com/doc/api/2.0/yii-db-connection#$enableLogging-detail

Yes, thank you. But, "workaround" is not the same as "right way" :)))

that is not a workaround, that is the correct way to disable query logging. errors are still being logged.

Was this page helpful?
0 / 5 - 0 ratings