Closed dicrtarasov closed 4 years ago
SQL queries is most for debugging purposes.
From Wiki: https://en.wikipedia.org/wiki/Syslog#Severity_level
Info
level used for information messages such as staring/stopping jobs or business logic, ex. "use login", "order send". Dumping full SQL queries with data is a debugging level, not a info.
https://dzone.com/articles/logging-levels-what-they-are-and-how-they-help-you quote: "INFO messages correspond to normal application behavior and milestones. You probably won’t care too much about these entries during normal operations, but they provide the skeleton of what happened. A service started or stopped. You added a new user to the database. That sort of thing."
https://reflectoring.io/logging-levels/ quote: "The INFO level should be used to document state changes in the application or some entity within the application. This information can be helpful during development and sometimes even in production to track what is actually happening in the system. Concrete examples for using the INFO level are: the application has started with configuration parameter x having the value y a new entity (e.g. a user) has been created or changed its state the state of a certain business process (e.g. an order) has changed from “open” to “processed” a regularly scheduled batch job has finished and processed z items."
http://thejoyofcode.com/Logging_Levels_and_how_to_use_them.aspx quote: "The Information level is typically used to output information that is useful to the running and management of your system. Information would also be the level used to log Entry and Exit points in key areas of your application. However, you may choose to add more entry and exit points at Debug level for more granularity during development and testing."
You are correct but the change may cause issues for many projects already relying on this logging level.
The problem with changing to trace
level is that these are excluded before being added to the logger in production environment, so you can not log SQL queries in production with a higher log level.
You can disable logging these messages:
https://www.yiiframework.com/doc/api/2.0/yii-db-connection#$enableLogging-detail
See also https://github.com/yiisoft/yii2/issues/1662#issuecomment-438719977
yii\db
package log low-level trace messages toinfo
level:Default application log must not contains low level DB messages at info level, because it generates huge log files which become unusabe for important messages. There must be more important information messages at this level.
Excluding
yii\db\*
from log target by adding exception:is not a right way for default configuration and also will disable error and warning messages from \yii\db.
There are no good workaround for this except of separate db-error.log for yii\db :(