Query pattern: optional. If specified, this filter will be invoked only if the current SQL matches this. Can be a string or a regular expression.
Packet types : optional. If specified, a comma-separated list of packet types for which this filter should be called, for instance: Row,NBCRow. Spaces are ignored.
Client IPs: optional. If specified, a comma-separated (or line break separated) list of IP4 or IP6 addresses or regular expressions for IP addresses.
Users: optional. If specified, a comma-separated (or line break separated) list of user names or regular expressions for user names.
You can catch response packets of type Error and log them to a file or some other system to keep track of certain problems:
Note that, if performance is critical, it may be a good idea to store the out object in the connection context to avoid opening and closing it all the time: