Skip to content

Commit

Permalink
Merge pull request #235 from kookmin-sw/feature/be/#230-Loggig
Browse files Browse the repository at this point in the history
fix : GET 로깅 제외
  • Loading branch information
mclub4 authored May 22, 2024
2 parents cd6447e + 8f31b10 commit e18f418
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ public class GlobalLoggingFilter {
public GlobalFilter preLoggingFilter() {
return (exchange, chain) -> {
ServerHttpRequest request = exchange.getRequest();

log.info("Global Filter Start: request id -> {}", request.getId());
log.info("Request: {} {}", request.getMethod(), request.getURI());

if(request.getHeaders().containsKey("Authorization")) {
log.info("Authorization: {}", request.getHeaders().get("Authorization"));
}

if(request.getMethod().toString().equals("GET")) {
return chain.filter(exchange);
}

return DataBufferUtils.join(request.getBody())
.flatMap(dataBuffer -> {
byte[] bodyBytes = new byte[dataBuffer.readableByteCount()];
Expand All @@ -39,8 +51,6 @@ public GlobalFilter preLoggingFilter() {
jsonBody = bodyString;
}

log.info("Global Filter Start: request id -> {}", request.getId());
log.info("Request: {} {}", request.getMethod(), request.getURI());
log.info("Request Body: {}", jsonBody);

return chain.filter(exchange);
Expand Down
14 changes: 10 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
## Production Deploy Version

version: '3'
networks:
backend_network:
ssl_network:

services:
redis:
Expand Down Expand Up @@ -34,6 +31,7 @@ services:
ports:
- "8081:8081"
networks:
- gateway_network
- backend_network

spring:
Expand Down Expand Up @@ -87,7 +85,7 @@ services:
- "ruby"
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
networks:
- backend_network
- gateway_network
- ssl_network

certbot:
Expand All @@ -99,3 +97,11 @@ services:
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
networks:
- ssl_network

networks:
gateway_network:
driver: bridge
backend_network:
driver: bridge
ssl_network:
driver: bridge

0 comments on commit e18f418

Please sign in to comment.