[NO-ISSUE] Add applicationName property

This commit is contained in:
woozu-shin 2023-10-10 20:42:41 +09:00
parent b9bf4386ae
commit beb6c619e5
3 changed files with 6 additions and 2 deletions

View File

@ -23,12 +23,14 @@ public class LoggingInterceptor implements HandlerInterceptor {
private final LogPersistenceService logPersistenceService;
private final LoggingProperties.HttpMethod httpMethodProperties;
private final LoggingProperties.HttpStatus httpStatusProperties;
private final String applicationName;
public LoggingInterceptor(LogPersistenceService logPersistenceService,
LoggingProperties loggingProperties) {
this.logPersistenceService = logPersistenceService;
this.httpMethodProperties = loggingProperties.getHttpMethod();
this.httpStatusProperties = loggingProperties.getHttpStatus();
this.applicationName = loggingProperties.getApplicationName();
}
@Override
@ -42,7 +44,7 @@ public class LoggingInterceptor implements HandlerInterceptor {
.body(getBodyIfAvailable(request))
.requestedAt(Instant.now())
.traceId(MDC.get("traceId"))
.applicationName("myoa-engineering-logging-sample")
.applicationName(applicationName)
.build();
loggingRequest(requestLog);
logPersistenceService.save(requestLog);
@ -91,7 +93,7 @@ public class LoggingInterceptor implements HandlerInterceptor {
.body(getBodyIfAvailable(response))
.respondedAt(Instant.now())
.traceId(MDC.get("traceId"))
.applicationName("myoa-engineering-logging-sample")
.applicationName(applicationName)
.build();
loggingResponse(responseLog);
logPersistenceService.save(responseLog);

View File

@ -14,6 +14,7 @@ public class LoggingProperties {
private HttpMethod httpMethod;
private HttpStatus httpStatus;
private String applicationName;
@Getter
@Setter

View File

@ -21,6 +21,7 @@ logging:
org.hibernate.SQL: DEBUG
org.hibernate.type.descriptor.sql: TRACE
web:
application-name: myoa-engineering-logging-sample
http-method:
excludes:
- GET