Gjall - Spring Extension 2nd Series. API Logging.
Gjall(Gjallarhorn) name stemmed from the Norse Mythology. - wikipedia
API Logging is a important issue in modern web environment reasons below.
Spring framework provides AbstractRequestLoggingFilter since 1.2.5
and ContentCachingRequest(Response)Wrapper since 4.1.3
but we need more information in our products.
gjall defines its own goal - doing simply, get powerful API logging.
But now, we can use httptrace endpoint of actuator over Spring Boot 2.
httptrace endpoint includes almost all of feature of gjall, and provide more convenient and stable.
We recommend gjall to users like below
but, always be careful to use BODY logging
@Configuration
public class GjallConfig extends ApiLoggingConfigurerAdapter {
@Override
public void configure(ApiLoggingConfigurerBuilder configurerBuilder) {
configurerBuilder
.beforeHandler((httpServletRequest, apiLog) -> {
// implements Actions you want to do BEFORE REQUEST
// OR make Spring Bean type of BeforeRequestLoggingHandler
})
.afterHandler((httpServletRequest, httpServletResponse, apiLog) -> {
// implements Actions you want to do AFTER REQUEST
// OR make Spring Bean type of AfterRequestLoggingHandler
})
.request()
.includeHeaders(true) // Include Request Header - default false
.payloadSize(1000) // Include Request Payload(Request Body). if set 0, payload not logging - default 0
.and()
.response()
.includeHeaders(true) // Include Response Header - default false
.payloadSize(3000) // Include Response Payload(Response Body). if set 0, payload not logging - default 0
.includeStatusCode(true) // Include Response Status - default false
.and()
.includeClientInfo(true) // enable user ip address, userId, session id Logging - default false
.includeQueryString(true); // uri include query string - default true
}
}
- gradle
compile group: ‘tech.sollabs’, name: ‘gjall’, version: ‘1.0.0-RELEASE’ ```
(https://github.com/CyanRYi/gjall)
MIT
@Cyan Raphael Yi