Fork me on GitHub

Instrumenting Log4j

The metrics-log4j module provides InstrumentedAppender, a Log4j Appender implementation which records the rate of logged events by their logging level.

You can add it to the root logger programmatically:

LogManager.getRootLogger().addAppender(new InstrumentedAppender(registry));