use of com.codahale.metrics.log4j2.InstrumentedAppender in project graylog2-server by Graylog2.
the class CmdLineTool method addInstrumentedAppender.
private void addInstrumentedAppender(final MetricRegistry metrics, final Level level) {
final InstrumentedAppender appender = new InstrumentedAppender(metrics, null, null, false);
appender.start();
final LoggerContext context = (LoggerContext) LogManager.getContext(false);
final org.apache.logging.log4j.core.config.Configuration config = context.getConfiguration();
config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME).addAppender(appender, level, null);
context.updateLoggers(config);
}
use of com.codahale.metrics.log4j2.InstrumentedAppender in project curiostack by curioswitch.
the class MonitoringModule method configureLogMetrics.
private static void configureLogMetrics() {
InstrumentedAppender appender = InstrumentedAppender.createAppender("PROMETHEUS");
appender.start();
LoggerContext context = (LoggerContext) LogManager.getContext(false);
Configuration config = context.getConfiguration();
config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME).addAppender(appender, null, null);
context.updateLoggers(config);
}
use of com.codahale.metrics.log4j2.InstrumentedAppender in project metrics by dropwizard.
the class InstrumentedAppenderTest method usesSharedRegistries.
@Test
public void usesSharedRegistries() throws Exception {
String registryName = "registry";
SharedMetricRegistries.add(registryName, registry);
final InstrumentedAppender shared = new InstrumentedAppender(registryName);
shared.start();
when(event.getLevel()).thenReturn(Level.INFO);
shared.append(event);
assertThat(registry.meter(METRIC_NAME_PREFIX + ".info").getCount()).isEqualTo(1);
}
Aggregations