Skip to content

oscarraigadevinta/karyon2-accesslog

 
 

Repository files navigation

Karyon Access Log Interceptor Module

Build Status

Maven Central

This module add an Interceptor to Karyon so that log all requests.

How to use

First of all, add to your build.gradle the dependency as usually do, for example:

dependencies {
  ...
  compile 'com.scmspain.karyon:karyon2-accesslog:x.x.x'
}

Remember to check the maven central badge to get the latest version.

Then include AccessLogModule in your AppServer as follows:

...
@Modules(
    include = {
        ...
        AccessLogModule.class
    })
public interface AppServer {
  ...
}

And finally intercept all urls:

@Override
protected void configureServer() {
  ...
  interceptorSupport().forUri("/*").intercept(AccessLogInterceptor.class);
}

Log Formatter

By default CombinedApacheLog format is bind, but you can override this in your module as follows:

@Override
protected void configure() {
  ...
  binder.bind(AccessLogFormatter.class).to(JsonLog.class);
}

Available formatter classes:

  • JsonLog print the Access log as a Json.
  • CommonApacheLog print a default Apache Access log.
  • CombinedApacheLog print a Combined Apache Access log (common plus referrer and user agent).
  • SchibstedApacheLog print a Custom Access log showing Combined Access Log plus extra information like response time and response size.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%