views:

177

answers:

0

I've configured the MySQL connector for Java to report metrics using:

logger=com.mysql.jdbc.log.Log4JLogger&gatherPerfMetrics=true&reportMetricsIntervalMillis=60000

That works just fine for one data source, but when I have three there is no way to distinguish them, since they all look like:

2009-11-13 12:37:05,506 INFO MySQL ** Performance Metrics Report **

Longest reported query: 0 ms
Shortest reported query: 9223372036854775807 ms
Average query execution time: NaN ms
Number of statements executed: 0
Number of result sets created: 0
Number of statements prepared: 0
Number of prepared statement executions: 0

The logger name is MySQL for all of them. I've considered using MDC or NDC but I can't see how to make it work.

How can I configure the logger to include some sort of identification ? Ideally this would be the host name and the database name.