Spring MVC Request/Response logger

Log Inbound requests and Outbound responses

License

License

Categories

Categories

Spring MVC User Interface Web Frameworks
GroupId

GroupId

com.github.yegorbabarykin
ArtifactId

ArtifactId

spring-mvc-logger
Last Version

Last Version

1.1
Release Date

Release Date

Type

Type

jar
Description

Description

Spring MVC Request/Response logger
Log Inbound requests and Outbound responses
Project URL

Project URL

https://github.com/YegorBabarykin/spring-mvc-logger
Project Organization

Project Organization

com.github.yegorbabarykin
Source Code Management

Source Code Management

https://github.com/YegorBabarykin/spring-mvc-logger

Download spring-mvc-logger

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.yegorbabarykin/spring-mvc-logger/ -->
<dependency>
    <groupId>com.github.yegorbabarykin</groupId>
    <artifactId>spring-mvc-logger</artifactId>
    <version>1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.yegorbabarykin/spring-mvc-logger/
implementation 'com.github.yegorbabarykin:spring-mvc-logger:1.1'
// https://jarcasting.com/artifacts/com.github.yegorbabarykin/spring-mvc-logger/
implementation ("com.github.yegorbabarykin:spring-mvc-logger:1.1")
'com.github.yegorbabarykin:spring-mvc-logger:jar:1.1'
<dependency org="com.github.yegorbabarykin" name="spring-mvc-logger" rev="1.1">
  <artifact name="spring-mvc-logger" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.yegorbabarykin', module='spring-mvc-logger', version='1.1')
)
libraryDependencies += "com.github.yegorbabarykin" % "spring-mvc-logger" % "1.1"
[com.github.yegorbabarykin/spring-mvc-logger "1.1"]

Dependencies

compile (1)

Group / Artifact Type Version
commons-io : commons-io jar 2.6

provided (4)

Group / Artifact Type Version
org.springframework : spring-webmvc jar 5.1.8.RELEASE
javax.servlet : javax.servlet-api jar 4.0.1
org.projectlombok : lombok jar 1.18.8
org.slf4j : slf4j-api jar 1.7.26

Project Modules

There are no modules declared in this project.

spring-mvc-logger

This library is used to log inbound and outbound requests for javax servlets

Using example for Spring MVC

Add dependency in pom.xml

<dependency>
    <groupId>com.github.yegorbabarykin</groupId>
    <artifactId>spring-mvc-logger</artifactId>
    <version>1.1</version>
</dependency>

Or in gradle

compile group: 'com.github.yegorbabarykin', name: 'spring-mvc-logger', version: '1.0'

Add new configuration for Spring MVC

@Configuration
public class LoggingConfiguration implements WebMvcConfigurer {

    @Bean
    public FilterRegistrationBean<WrapHttpRequestResponseFilter> loggingFilter() {
        FilterRegistrationBean<WrapHttpRequestResponseFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new WrapHttpRequestResponseFilter());
        registrationBean.addUrlPatterns("*");
        return registrationBean;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new RequestLoggingInterceptor());
    }
}

Versions

Version
1.1
1.0