[system log] Component based logging
Recently new logging system was developed (see
I propose, that we can log not only errors, but information about what happens in the system at INFO log level. This way nothing will be logged by default, but if we need to test something we can always enable logging of INFO level messages.
We can log following:
- scheduled task (start, end, timeout)
- e-mail sending
- form submission maibox reading (each processed e-mail info)
I liked how it's done in Jira (from Atlassian company) - all stuff type, that can be logged is displayed a big list and text to each loggable item group it's possible to set logging level.
This way you can narrow down logging of only needed information without need to change anything in the code.
Maybe we need to introduce "Log Component" term to System Log and then whoever does logging can pass in a component and actual log level would be determined on the fly based on component.
All component-log-level mapping then would go to new SystemLogComponents table:
- LogComponentId
- Code
- LogLevel
In future we can add more component-specific fields, that would affect logging. Each component would be referenced by "Code" from PHP code, because we can't determine each component ID in database at moment, when logging code is written.
For backwards compatibility with native logging system we need to include component name in error message text this way:
[component.name] error message itself
Then kLogger class (when used) will extract component and display it in separate column. In cases, when "System Log" is disabled (e.g. error messages goes to Web Server log), then component specified this way would give more clue about error too.