Code Monkey home page Code Monkey logo

hawtio-logback's Introduction

hawtio-logback

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)

Why

In our project we simply wanted to access our most-recent (Logback-Based) log outputs from within the 'Hawtio' app

Open Items

* Add Maven Coordinates Support * Add Better Predicate Filtering Support * CallerData is not always determined correclty

Howto Integrate

DefaultCyclicBufferAppender

The DefaultCyclicBufferAppender keeps N-Log-Events in-memory.

Spring-Annotation-Config

@Configuration
public class LogbackLogQueryConfig {
    @Bean
    public LogbackLogQuery createLogbackAwareLogQueryMBeanImpl() {
        return new LogbackLogQuery(new CyclicBufferAppenderWrapper(new CyclicBufferAppender<ILoggingEvent>(), 10));
    }
}

Spring-XML-Config

```xml
<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>
```

LevelBasedCyclicBufferAppender

Allows to define a buffer-size for each level. Thus N-Log-Events for every Level are keept in-memory

Spring-Annotation-Config

```java @Configuration public class LogbackLogQueryConfig { @Bean public LogbackAwareLogQueryMBeanImpl createLogbackAwareLogQueryMBeanImpl() { return new LogbackLogQuery( new LevelBasedCyclicBufferAppender( ImmutableMap.builder() .put("TRACE", 256) .put("DEBUG", 256) .put("INFO", 1024) .put("WARN", 1024) .put("ERROR", 1024) .build() ) ); } } ```

hawtio-logback's People

Contributors

pavax avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.