smart-http-logger

auto http logger for spring-boot

License

License

Categories

Categories

Spring Boot Container Microservices
GroupId

GroupId

jp.spring-boot-reference
ArtifactId

ArtifactId

smart-http-logger
Last Version

Last Version

1.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

smart-http-logger
auto http logger for spring-boot
Project URL

Project URL

https://github.com/kcwebapply/smart-http-logger
Source Code Management

Source Code Management

https://github.com/kcwebapply/smart-http-logger

Download smart-http-logger

How to add to project

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

Dependencies

compile (2)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-web jar 2.1.3.RELEASE
org.springframework.boot : spring-boot-configuration-processor Optional jar 2.1.3.RELEASE

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.20

test (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar 2.1.3.RELEASE

Project Modules

There are no modules declared in this project.

SmartHttpLogger

apache licensed Java Maven Central

Auto http logger for SpringBoot .

introduction

you can logging automatically http req/res information that come to your application's api.

2019-04-19 20:20:00 ERROR 62593 --- [nio-8888-exec-2] j.s.s.logging.SmartHttpLogger:
[ 'method' = 'GET', 'url' = '/user/100', 'request' = 'null', 'status' = '401', 'response' = '{"status":401,"message":"authorization exception"}', 'time' = '82ms' ]
2019-04-19 20:20:02  INFO 62593 --- [nio-8888-exec-3] j.s.s.logging.SmartHttpLogger: 
[ 'method' = 'POST', 'url' = '/user', 'request' = '{"id":"1000","name":"kc","score":100}', 'status' = '200', 'response' = '{"id":"1000","name":"kc","score":100}', 'time' = '35ms' ]

Usage

1. adding dependency on pom

<dependency>
	<groupId>jp.spring-boot-reference</groupId>
	<artifactId>smart-http-logger</artifactId>
	<version>1.0.0</version>
</dependency>

2. modify log output as you like.

you can hide some http information by setting.
smarthlog.output.method=false 
smarthlog.output.status=false

Then, output become

2019-04-19 20:20:00 ERROR 62593 --- [nio-8888-exec-2] j.s.s.logging.SmartHttpLogger: 
['url' = '/user/100', 'request' = 'null', 'response' = '{"status":401,"message":"authorization exception"}', 'time' = '82ms' ]
you can mask header information.

you can hide header information by adding setting on application.properties like below.

smartlog.header.secrets=Authorization,host

then, Authorization and host header's information is hidden by xxxxxxxxxxxxxx expression.

installation

adding dependency on pom.xml

<dependency>
	<groupId>jp.spring-boot-reference</groupId>
	<artifactId>smart-http-logger</artifactId>
	<version>1.0.0</version>
</dependency>

Versions

Version
1.0.3
1.0.2
1.0.1
1.0.0