This module add an Interceptor to Karyon so that log all requests.
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);
}
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);
}
- 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.