[NO-ISSUE] Add applicationName property
This commit is contained in:
parent
b9bf4386ae
commit
beb6c619e5
|
@ -23,12 +23,14 @@ public class LoggingInterceptor implements HandlerInterceptor {
|
||||||
private final LogPersistenceService logPersistenceService;
|
private final LogPersistenceService logPersistenceService;
|
||||||
private final LoggingProperties.HttpMethod httpMethodProperties;
|
private final LoggingProperties.HttpMethod httpMethodProperties;
|
||||||
private final LoggingProperties.HttpStatus httpStatusProperties;
|
private final LoggingProperties.HttpStatus httpStatusProperties;
|
||||||
|
private final String applicationName;
|
||||||
|
|
||||||
public LoggingInterceptor(LogPersistenceService logPersistenceService,
|
public LoggingInterceptor(LogPersistenceService logPersistenceService,
|
||||||
LoggingProperties loggingProperties) {
|
LoggingProperties loggingProperties) {
|
||||||
this.logPersistenceService = logPersistenceService;
|
this.logPersistenceService = logPersistenceService;
|
||||||
this.httpMethodProperties = loggingProperties.getHttpMethod();
|
this.httpMethodProperties = loggingProperties.getHttpMethod();
|
||||||
this.httpStatusProperties = loggingProperties.getHttpStatus();
|
this.httpStatusProperties = loggingProperties.getHttpStatus();
|
||||||
|
this.applicationName = loggingProperties.getApplicationName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,7 +44,7 @@ public class LoggingInterceptor implements HandlerInterceptor {
|
||||||
.body(getBodyIfAvailable(request))
|
.body(getBodyIfAvailable(request))
|
||||||
.requestedAt(Instant.now())
|
.requestedAt(Instant.now())
|
||||||
.traceId(MDC.get("traceId"))
|
.traceId(MDC.get("traceId"))
|
||||||
.applicationName("myoa-engineering-logging-sample")
|
.applicationName(applicationName)
|
||||||
.build();
|
.build();
|
||||||
loggingRequest(requestLog);
|
loggingRequest(requestLog);
|
||||||
logPersistenceService.save(requestLog);
|
logPersistenceService.save(requestLog);
|
||||||
|
@ -91,7 +93,7 @@ public class LoggingInterceptor implements HandlerInterceptor {
|
||||||
.body(getBodyIfAvailable(response))
|
.body(getBodyIfAvailable(response))
|
||||||
.respondedAt(Instant.now())
|
.respondedAt(Instant.now())
|
||||||
.traceId(MDC.get("traceId"))
|
.traceId(MDC.get("traceId"))
|
||||||
.applicationName("myoa-engineering-logging-sample")
|
.applicationName(applicationName)
|
||||||
.build();
|
.build();
|
||||||
loggingResponse(responseLog);
|
loggingResponse(responseLog);
|
||||||
logPersistenceService.save(responseLog);
|
logPersistenceService.save(responseLog);
|
||||||
|
|
|
@ -14,6 +14,7 @@ public class LoggingProperties {
|
||||||
|
|
||||||
private HttpMethod httpMethod;
|
private HttpMethod httpMethod;
|
||||||
private HttpStatus httpStatus;
|
private HttpStatus httpStatus;
|
||||||
|
private String applicationName;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|
|
@ -21,6 +21,7 @@ logging:
|
||||||
org.hibernate.SQL: DEBUG
|
org.hibernate.SQL: DEBUG
|
||||||
org.hibernate.type.descriptor.sql: TRACE
|
org.hibernate.type.descriptor.sql: TRACE
|
||||||
web:
|
web:
|
||||||
|
application-name: myoa-engineering-logging-sample
|
||||||
http-method:
|
http-method:
|
||||||
excludes:
|
excludes:
|
||||||
- GET
|
- GET
|
||||||
|
|
Loading…
Reference in New Issue