Problem/Motivation
The dblog was ported from Drupal 7 to Drupal 8 following some general guidelines, but in general is far to be as extensible and object oriented like other Drupal 8 modules from core.
Proposed resolution
There are several front of actions to modernize this module. The plan is to have at least a set of this changes ready to include in 8.4.x.
- Inject a storage object into the dblog logger service. This will decouple the dblog module from using SQL based databases. #2458191: Provide a storage backend for dblog module
- Historically, it has been a requirement to customize the recent logs listing. This can be done with #2015149: Replace dblog recent log entries with a view
- There are some files that could be removed
dblog.admin.inc
has only a few functions that could be part of another class. #2852990: Deprecate dblog_filters_dblog_get_message_types
could be deprecated too (Part of #2458191: Provide a storage backend for dblog module) - Tests for the dblog are mixing the use of the interface with the logger functionality, we could create independent kernel tests to improve the test coverage of the swappable service (Initial kernel tests are part of #2458191: Provide a storage backend for dblog module), #2848529: Move DbLogTest::verifyCron to a kernel test
- The watchdog table could be renamed for consistence #2378963: Rename watchdog table
Additionally to this there are some ideas to convert the logs into entities #2401463: Make dblog entities. This makes sense to get better integration with views and if a module swap the logger.dblog service could have immediate views support. That issue also points to have a custom service for "fast writing", I think we already have that in Drupal\dblog\Logger\DbLog::log
.
Remaining tasks
- Discuss the plan.
- Create some issues for the remaining tasks
- Start to work on them. Currently most of the work is blocked by: #2851293: dblog is using the wrong views field, filter and relationships definitions
User interface changes
None
API changes
- Api addition: A new storage backend for Drupal\dblog\Logger\dblog.
dblog_filters
and_dblog_get_message_types
deprecated.- A new trait to create fake log entries.
Data model changes
Maybe a rename of the watchdog table.
Comments
Comment #2
dagmarComment #3
dagmarComment #4
dagmarComment #5
dagmarComment #6
dagmarComment #7
dagmarComment #8
dagmarComment #20
jigariusI'm not sure if this is the right place to add my suggestion, but it'd be great to have some filter/search capacity out of the box. Say,
* Filter by date range
* Search for text (I understand that this is complicated given the way log messages are translated, but I'm just thinking aloud).