Quick-And-Dirty approach in order to provide 'LogQuery'-Support (see: https://github.com/fabric8io/fabric8/tree/master/insight/insight-log-core) for Logback.
The Approach is mainly influenced by the insight-log4j project (see: https://github.com/fabric8io/fabric8/tree/master/insight/insight-log4j)
In our project we simply wanted to access our most-recent (Logback-Based) log outputs from within the 'Hawtio' app * Add Maven Coordinates Support * Add Better Predicate Filtering Support * CallerData is not always determined correclty The DefaultCyclicBufferAppender keeps N-Log-Events in-memory.@Configuration
public class LogbackLogQueryConfig {
@Bean
public LogbackLogQuery createLogbackAwareLogQueryMBeanImpl() {
return new LogbackLogQuery(new CyclicBufferAppenderWrapper(new CyclicBufferAppender<ILoggingEvent>(), 10));
}
}
<bean class="ch.mimacom.log.logback.LogbackLogQuery"
init-method="start"
destroy-method="stop">
<constructor-arg name="logQueryAwareAppender">
<bean class="ch.mimacom.log.logback.appender.CyclicBufferAppenderWrapper">
<bean class="ch.qos.logback.core.read.CyclicBufferAppender">
<constructor-arg name="maxSize" value="10"/>
</bean>
</bean>
</constructor-arg>
</bean>