Skip to content
Snippets Groups Projects
Commit 6a75260e authored by ThanKarab's avatar ThanKarab
Browse files

Reduced logs and removed spacing.

parent 8e21f0c6
No related branches found
No related tags found
1 merge request!17Feat/elk stack
......@@ -50,7 +50,7 @@ frontend:
logging:
level:
root: {{ default .Env.LOG_LEVEL "INFO" }}
root: {{ default .Env.LOG_LEVEL "ERROR" }}
org:
springframework:
security: ERROR
......
......@@ -274,7 +274,6 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
public void logout() {
// POSTするリクエストパラメーターを作成
Logging.LogAction("refresh token ", this.oauth2ClientContext.getAccessToken().getRefreshToken().getValue());
RestTemplate restTemplate = new RestTemplate();
MultiValueMap<String, String> formParams = new LinkedMultiValueMap<>();
formParams.add("client_id", hbp().getClientId());
......@@ -284,7 +283,6 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
// リクエストを作成
Logging.LogAction("logoutUri is ", logoutUri);
RequestEntity<MultiValueMap<String, String>> requestEntity =
new RequestEntity<>(formParams, httpHeaders, HttpMethod.POST,
URI.create(logoutUri));
......
......@@ -11,9 +11,7 @@ public class Logging {
public static void LogUserAction(String userName, String endpoint, String actionInfo) {
LOGGER.info(" User -> " + userName + " ,"
+ calculateAdditionalSpacing(userName.length(), 8)
+ "Endpoint -> " + endpoint + " ,"
+ calculateAdditionalSpacing(endpoint.length(), 32)
+ "Info -> " + actionInfo);
}
......@@ -21,20 +19,6 @@ public class Logging {
public static void LogExperimentAction(String experimentName, UUID experimentId, String actionInfo) {
LOGGER.info(" Experiment -> " + experimentName
+ "(" + experimentId + ") ,"
+ calculateAdditionalSpacing(experimentName.length() + experimentId.toString().length() + 2, 20)
+ "Info -> " + actionInfo);
}
// Used when a user is not authorised yet
public static void LogAction(String actionName, String actionIdInfo) {
LOGGER.info(" Action -> " + actionName + " ,"
+ calculateAdditionalSpacing(actionName.length() + 2, 20)
+ "Info -> " + actionIdInfo);
}
// Calculates the spacing that is needed to create consistent logs.
private static String calculateAdditionalSpacing(Integer currentLen, Integer maxLen) {
int additionalSpacing = (maxLen > currentLen ? maxLen - currentLen + 2 : 2);
return String.format("%" + additionalSpacing + "s", "");
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment