All Downloads are FREE. Search and download functionalities are using the official Maven repository.

manual.logback.rst Maven / Gradle / Ivy

.. _manual-logback:

#####################
Instrumenting Logback
#####################

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

.. _Logback: https://logback.qos.ch/

You add it to the root logger programmatically:

.. code-block:: java

    final LoggerContext factory = (LoggerContext) LoggerFactory.getILoggerFactory();
    final Logger root = factory.getLogger(Logger.ROOT_LOGGER_NAME);

    final InstrumentedAppender metrics = new InstrumentedAppender(registry);
    metrics.setContext(root.getLoggerContext());
    metrics.start();
    root.addAppender(metrics);




© 2015 - 2025 Weber Informatics LLC | Privacy Policy