O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Error logging in JSON format

To use the JSON format for logging, you need to load the JSON log writer called log_sink_json. You can use the built-in filter, log_filter_internal, for filtering:

  1. Install the JSON log writer:
mysql> INSTALL COMPONENT 'file://component_log_sink_json';Query OK, 0 rows affected (0.05 sec)
  1. Make it persistent across restarts:
mysql> SET PERSIST log_error_services = 'log_filter_internal; log_sink_json';Query OK, 0 rows affected (0.00 sec)
  1. The JSON log writer determines its output destination based on the default error log destination, which is given by the log_error system variable:
mysql> SHOW VARIABLES LIKE 'log_error';+---------------+---------------------------+| Variable_name | Value                     |+---------------+---------------------------+ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required