Install
To store log messages in a database, you must enable the admin_panel_log
extension, initialize the database log table,
and create a handler in your ckan config file.
- Add
admin_panel_log
to theckan.plugins
setting in your CKAN config file. - Initialize all missing tables with:
ckan db pending-migrations --apply
-
To register a handler, you must specify it in your CKAN configuration file. Due to some CKAN specifics, the logger needs to know the database URI to initialize itself. Provide it with the
kwargs
option.[handler_dbHandler] class = ckanext.ap_log.log_handlers.DatabaseHandler formatter = generic level = NOTSET kwargs={"db_uri": "postgresql://ckan_default:pass@localhost/master"}
-
The logging handler must be also included in
[handlers]
section.[handlers] keys = console, dbHandler
- The last thing you need to do is to add our handler to a logger you need. For example, if you want to log only
ckan
logs, do this:[logger_ckan] level = INFO handlers = console, dbHandler