View source | Discuss this page | Page history | Printable version   

Module:DB Pool Logging Utilities

Contents

Introduction

DB Pool Logging Utilities is a community module that provides the ability of generating log for some events of database Pool.

It is primarily intended to be used by developers to facilitate them to pinpoint the code that is causing performance issues related to database queries/connections.

This information is logged in standard openbravo log.

Requirements

Performance considerations

When installing this module, especially in production environments, take into account that, depending on how it is configured, it can cause an overhead in terms of performance. Read carefully Configuration section to select the settings before using it. You can find here some measures taken regarding this overhead.

What to log

Slow Queries

Logging slow queries is important to fine tune them. DB logs (ie. min_duration_statements in PostgreSQL) allows to log them, but sometimes it is not easy from those logs to reach the code that triggered the query. Adding stack traces to logged slow queries helps to easily know the code behind the queries.

Connections

Some times, it is useful also to know all the connections that are present in the pool, understanding where they were borrowed for last time.


Configuration

This module is highly configurable in order to exactly determine what to log. Note that by default the module is not enabled, so even it is installed in the Openbravo instance, it will not log anything until it is configured.

There are two ways to configure the settings for this module: Openbravo.properties and MBeans.

How to set parameters

Openbravo.properties

Bulbgraph.png   Note after any change in Openbravo.properties, you will need to compile and restart Tomcat in order to make it effective.

All parameters described in Configuration section can be set through Openbravo.properties file. The properties are named db.pool.logger. followed the parameter name to configure starting in lowercase. For example to enable logging, use: db.pool.logger.enabled=true.

Settings defined in Openbravo.properties are applied when Tomcat starts.

MBeans

It is also possible to change logging configuration in a live instance using JMX MBeans. The MBean is registered in Openbravo:contextName-name=DBPoolLogger where contextName is the application's context name.

There are different clients to connect to JMX MBeans:

Jmxterm-pool-log.png

Parameters

Settings for logging statements:

Stack trace configuration:

Settings for logging connections:

Logging connections, these features are only available through JMX MBeans in case TrackConnections is set to true:

Retrieved from "http://wiki.openbravo.com/wiki/Module:DB_Pool_Logging_Utilities"

This page has been accessed 2,228 times. This page was last modified on 20 June 2017, at 07:27. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.