Skip to content
This repository has been archived by the owner on Aug 7, 2018. It is now read-only.

Latest commit

 

History

History
60 lines (47 loc) · 1.68 KB

README.md

File metadata and controls

60 lines (47 loc) · 1.68 KB

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.