From 2f4de240b09deb66896f1589d5dd953f4d7063d1 Mon Sep 17 00:00:00 2001 From: SHM Date: Fri, 25 Apr 2025 15:51:23 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=84=B1=ED=98=84=EB=AA=A8]=20LogLevel=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VPKI/VPKI.Library/Services/HttpService.cs | 8 +++---- .../Controllers/AuthController.cs | 12 +++++----- .../Controllers/UserController.cs | 6 ++--- .../Controllers/VPKIBaseController.cs | 20 ++++++++-------- .../Controllers/VPKIv1_Controller.cs | 12 +++++----- .../Controllers/VPKIv2_Controller.cs | 24 +++++++++---------- .../VPKI.Web.Api/Services/VpkiBaseService.cs | 2 +- .../VPKI.Web.Client/Services/ApiService.cs | 8 +++---- 8 files changed, 46 insertions(+), 46 deletions(-) diff --git a/Projects/VPKI/VPKI/VPKI.Library/Services/HttpService.cs b/Projects/VPKI/VPKI/VPKI.Library/Services/HttpService.cs index f60bd5a..1b10694 100644 --- a/Projects/VPKI/VPKI/VPKI.Library/Services/HttpService.cs +++ b/Projects/VPKI/VPKI/VPKI.Library/Services/HttpService.cs @@ -31,13 +31,13 @@ namespace VPKI.Library.Services httpClient.Timeout = new TimeSpan(0, 0, timeOutSec); httpClient.BaseAddress = new Uri($"{url}"); - Log4net.WriteLine($"[POST] Request({guid})::{url}{Environment.NewLine}{request?.ToJson()}", LogType.Warn); + Log4net.WriteLine($"[POST] Request({guid})::{url}{Environment.NewLine}{request?.ToJson()}", LogType.HTTP); DateTime requestTime = DateTime.Now; var res = await httpClient.PostAsJsonAsync(url, request); response = await res.Content.ReadFromJsonAsync(); - Log4net.WriteLine($"[POST] Rseponse({guid}) ({(DateTime.Now - requestTime).TotalSeconds} sec)::{url}{Environment.NewLine}{response?.ToJson()}", LogType.Warn); + Log4net.WriteLine($"[POST] Rseponse({guid}) ({(DateTime.Now - requestTime).TotalSeconds} sec)::{url}{Environment.NewLine}{response?.ToJson()}", LogType.HTTP); break; } catch (Exception e) @@ -72,12 +72,12 @@ namespace VPKI.Library.Services httpClient.Timeout = new TimeSpan(0, 0, timeOutSec); httpClient.BaseAddress = new Uri($"{url}"); - Log4net.WriteLine($"[GET] Request({guid})::{url}", LogType.Warn); + Log4net.WriteLine($"[GET] Request({guid})::{url}", LogType.HTTP); DateTime requestTime = DateTime.Now; response = await httpClient.GetFromJsonAsync(url); - Log4net.WriteLine($"[GET] Rseponse({guid}) ({(DateTime.Now - requestTime).TotalSeconds} sec)::{url}", LogType.Warn); + Log4net.WriteLine($"[GET] Rseponse({guid}) ({(DateTime.Now - requestTime).TotalSeconds} sec)::{url}", LogType.HTTP); } catch (Exception e) { diff --git a/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/AuthController.cs b/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/AuthController.cs index 6642110..7a2464a 100644 --- a/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/AuthController.cs +++ b/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/AuthController.cs @@ -40,7 +40,7 @@ namespace VPKI.Web.Api.Controllers [HttpPost("regisger")] public async Task Register([FromBody] RegisterModel request) { - Log4net.WriteLine(GetRequestLog(request).LogModelToString("Request Auth"), LogType.Debug); + Log4net.WriteLine(GetRequestLog(request).LogModelToString("Request Auth"), LogType.CONTROLLER); RegisterResponseModel response = new RegisterResponseModel(); @@ -49,7 +49,7 @@ namespace VPKI.Web.Api.Controllers response = await _authService.CreateUser(request); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response Auth"), LogType.Debug); + Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response Auth"), LogType.CONTROLLER); return Results.Ok(response); } @@ -57,7 +57,7 @@ namespace VPKI.Web.Api.Controllers [HttpPost("login")] public async Task Login([FromBody] LoginModel request) { - Log4net.WriteLine(GetRequestLog(request).LogModelToString("Request Auth"), LogType.Debug); + Log4net.WriteLine(GetRequestLog(request).LogModelToString("Request Auth"), LogType.CONTROLLER); LoginResponseModel response = new LoginResponseModel(); response.UserID = request.UserID; @@ -80,7 +80,7 @@ namespace VPKI.Web.Api.Controllers await _authService.UpdateLoginInfo(request, response.RefreshToken); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response Auth"), LogType.Debug); + Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response Auth"), LogType.CONTROLLER); return Results.Ok(response); } @@ -88,12 +88,12 @@ namespace VPKI.Web.Api.Controllers [HttpPost("logout")] public async Task Logout([FromBody] LogoutModel request) { - Log4net.WriteLine(GetRequestLog(request).LogModelToString("Request Auth"), LogType.Debug); + Log4net.WriteLine(GetRequestLog(request).LogModelToString("Request Auth"), LogType.CONTROLLER); var response = _authService.LogoutUser(request); await Task.CompletedTask; - Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response Auth"), LogType.Debug); + Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response Auth"), LogType.CONTROLLER); return Results.Ok(response); } diff --git a/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/UserController.cs b/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/UserController.cs index 1716573..947bcf4 100644 --- a/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/UserController.cs +++ b/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/UserController.cs @@ -26,7 +26,7 @@ namespace VPKI.Web.Api.Controllers Log4net.WriteLine(GetRequestLog().LogModelToString("Request Auth"), LogType.Debug); var response = await _userService.GetAllUsers(); - Log4net.WriteLine(GetRequestLog(response).LogModelToString("Response Auth"), LogType.Debug); + Log4net.WriteLine(GetRequestLog(response).LogModelToString("Response Auth"), LogType.CONTROLLER); return response; } @@ -35,10 +35,10 @@ namespace VPKI.Web.Api.Controllers [Authorize] public async Task UpdateUser(UserModel user) { - Log4net.WriteLine(GetRequestLog().LogModelToString("Request Auth"), LogType.Debug); + Log4net.WriteLine(GetRequestLog().LogModelToString("Request Auth"), LogType.CONTROLLER); var response = await _userService.UpdateUser(user); - Log4net.WriteLine(GetRequestLog(response).LogModelToString("Response Auth"), LogType.Debug); + Log4net.WriteLine(GetRequestLog(response).LogModelToString("Response Auth"), LogType.CONTROLLER); return response; } diff --git a/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/VPKIBaseController.cs b/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/VPKIBaseController.cs index ca8c7ae..28c3638 100644 --- a/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/VPKIBaseController.cs +++ b/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/VPKIBaseController.cs @@ -23,7 +23,7 @@ namespace VPKI.Web.Api.Controllers { List response = new List(); - Log4net.WriteLine(GetRequestLog().LogModelToString("Request"), LogType.Debug); + Log4net.WriteLine(GetRequestLog().LogModelToString("Request"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if (service != null) { @@ -36,7 +36,7 @@ namespace VPKI.Web.Api.Controllers response.Min(x => x!.TTbscsr!.CCuid); } - Log4net.WriteLine($"Ressponse::Start CCUID:{min}, Count:{response.Count}", LogType.Debug); + Log4net.WriteLine($"Ressponse::Start CCUID:{min}, Count:{response.Count}", LogType.CONTROLLER); return Results.Ok(response); } @@ -51,14 +51,14 @@ namespace VPKI.Web.Api.Controllers { CertificateHistoryModel response = new CertificateHistoryModel(); - Log4net.WriteLine(GetRequestLog().LogModelToString("Request"), LogType.Debug); + Log4net.WriteLine(GetRequestLog().LogModelToString("Request"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if (service != null) { response = await service.History(ccuid); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response"), LogType.Debug); + Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response"), LogType.CONTROLLER); return Results.Ok(response); } @@ -74,14 +74,14 @@ namespace VPKI.Web.Api.Controllers { string response = string.Empty; - Log4net.WriteLine(GetRequestLog().LogModelToString("Request"), LogType.Debug); + Log4net.WriteLine(GetRequestLog().LogModelToString("Request"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if (service != null) { response = service.GetSubCA(vpkiType, false); } await Task.CompletedTask; - Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response"), LogType.Debug); + Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response"), LogType.CONTROLLER); return Results.Ok(response); } @@ -97,13 +97,13 @@ namespace VPKI.Web.Api.Controllers { string response = string.Empty; - Log4net.WriteLine(GetRequestLog().LogModelToString("Request"), LogType.Debug); + Log4net.WriteLine(GetRequestLog().LogModelToString("Request"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if (service != null) { response = await service.GetCertificateInfo(ccuid); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response"), LogType.Debug); + Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response"), LogType.CONTROLLER); return Results.Ok(response); } @@ -119,13 +119,13 @@ namespace VPKI.Web.Api.Controllers { string response = string.Empty; - Log4net.WriteLine(GetRequestLog().LogModelToString("Request"), LogType.Debug); + Log4net.WriteLine(GetRequestLog().LogModelToString("Request"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if (service != null) { response = await service.Ocsp(ccuid); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response"), LogType.Debug); + Log4net.WriteLine(GetResponseLog(response).LogModelToString("Response"), LogType.CONTROLLER); return Results.Ok(response); } diff --git a/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/VPKIv1_Controller.cs b/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/VPKIv1_Controller.cs index 89328aa..7df0fb5 100644 --- a/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/VPKIv1_Controller.cs +++ b/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/VPKIv1_Controller.cs @@ -31,7 +31,7 @@ namespace VPKI.Web.Api.Controllers Response_Tbscsr response = new Response_Tbscsr(); Guid guid = Guid.NewGuid(); - Log4net.WriteLine(GetRequestLog(_request).LogModelToString($"Request ({guid})"), LogType.Info); + Log4net.WriteLine(GetRequestLog(_request).LogModelToString($"Request ({guid})"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if (service != null) @@ -39,7 +39,7 @@ namespace VPKI.Web.Api.Controllers response = await service.RequestTbscsr(_request); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})"), LogType.Info); + Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})"), LogType.CONTROLLER); return Results.Ok(response); } @@ -54,7 +54,7 @@ namespace VPKI.Web.Api.Controllers Response_Certificate response = new Response_Certificate(); Guid guid = Guid.NewGuid(); - Log4net.WriteLine(GetRequestLog(_request).LogModelToString($"Request ({guid})")); + Log4net.WriteLine(GetRequestLog(_request).LogModelToString($"Request ({guid})"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if (service != null) @@ -62,7 +62,7 @@ namespace VPKI.Web.Api.Controllers response = await service.RequestCertificate(_request); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})")); + Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})"), LogType.CONTROLLER); return Results.Ok(response); } @@ -77,7 +77,7 @@ namespace VPKI.Web.Api.Controllers Response_Verifyresult response = new Response_Verifyresult(); Guid guid = Guid.NewGuid(); - Log4net.WriteLine(GetRequestLog(request).LogModelToString("Request")); + Log4net.WriteLine(GetRequestLog(request).LogModelToString("Request"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if(service != null) @@ -85,7 +85,7 @@ namespace VPKI.Web.Api.Controllers response = await service.RequestVerifyresult(request); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})")); + Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})"), LogType.CONTROLLER); return Results.Ok(response); } diff --git a/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/VPKIv2_Controller.cs b/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/VPKIv2_Controller.cs index c6e18fa..aa61a4d 100644 --- a/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/VPKIv2_Controller.cs +++ b/Projects/VPKI/VPKI/VPKI.Web.Api/Controllers/VPKIv2_Controller.cs @@ -27,7 +27,7 @@ namespace VPKI.Web.Api.Controllers Response_Tbscsr response = new Response_Tbscsr(); Guid guid = Guid.NewGuid(); - Log4net.WriteLine(GetRequestLog(_request).LogModelToString($"Request ({guid})")); + Log4net.WriteLine(GetRequestLog(_request).LogModelToString($"Request ({guid})"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if(service != null) @@ -35,7 +35,7 @@ namespace VPKI.Web.Api.Controllers response = await service.RequestTbscsr(_request, Library.Enums.VpkiType.prov_cert); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})")); + Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})"), LogType.CONTROLLER); return Results.Ok(response); } @@ -51,7 +51,7 @@ namespace VPKI.Web.Api.Controllers Response_Certificate response = new Response_Certificate(); Guid guid = Guid.NewGuid(); - Log4net.WriteLine(GetRequestLog(_request).LogModelToString($"Request ({guid})")); + Log4net.WriteLine(GetRequestLog(_request).LogModelToString($"Request ({guid})"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if(service != null) @@ -59,7 +59,7 @@ namespace VPKI.Web.Api.Controllers response = await service.RequestCertificate(_request, Library.Enums.VpkiType.prov_cert); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})")); + Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})"), LogType.CONTROLLER); return Results.Ok(response); } @@ -75,7 +75,7 @@ namespace VPKI.Web.Api.Controllers Response_Verifyresult response = new Response_Verifyresult(); Guid guid = Guid.NewGuid(); - Log4net.WriteLine(GetRequestLog(request).LogModelToString($"Request ({guid})")); + Log4net.WriteLine(GetRequestLog(request).LogModelToString($"Request ({guid})"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if (service != null) @@ -83,7 +83,7 @@ namespace VPKI.Web.Api.Controllers response = await service.RequestVerifyresult(request); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})")); + Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})"), LogType.CONTROLLER); return Results.Ok(response); } @@ -155,7 +155,7 @@ namespace VPKI.Web.Api.Controllers Response_Tbscsr response = new Response_Tbscsr(); Guid guid = Guid.NewGuid(); - Log4net.WriteLine(GetRequestLog(_request).LogModelToString($"Request ({guid})")); + Log4net.WriteLine(GetRequestLog(_request).LogModelToString($"Request ({guid})"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if (service != null) @@ -163,7 +163,7 @@ namespace VPKI.Web.Api.Controllers response = await service.RequestTbscsr(_request, Library.Enums.VpkiType.vehicle_cert); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})")); + Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})"), LogType.CONTROLLER); return Results.Ok(response); } @@ -179,7 +179,7 @@ namespace VPKI.Web.Api.Controllers Response_Certificate response = new Response_Certificate(); Guid guid = Guid.NewGuid(); - Log4net.WriteLine(GetRequestLog(_request).LogModelToString($"Request ({guid})")); + Log4net.WriteLine(GetRequestLog(_request).LogModelToString($"Request ({guid})"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if (service != null) @@ -187,7 +187,7 @@ namespace VPKI.Web.Api.Controllers response = await service.RequestCertificate(_request, Library.Enums.VpkiType.vehicle_cert); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})")); + Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})"), LogType.CONTROLLER); return Results.Ok(response); } @@ -203,7 +203,7 @@ namespace VPKI.Web.Api.Controllers Response_Verifyresult response = new Response_Verifyresult(); Guid guid = Guid.NewGuid(); - Log4net.WriteLine(GetRequestLog(request).LogModelToString($"Request ({guid})")); + Log4net.WriteLine(GetRequestLog(request).LogModelToString($"Request ({guid})"), LogType.CONTROLLER); var service = _serviceProvider.GetService(); if (service != null) @@ -211,7 +211,7 @@ namespace VPKI.Web.Api.Controllers response = await service.RequestVerifyresult(request); } - Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})")); + Log4net.WriteLine(GetResponseLog(response).LogModelToString($"Response ({guid})"), LogType.CONTROLLER); return Results.Ok(response); } diff --git a/Projects/VPKI/VPKI/VPKI.Web.Api/Services/VpkiBaseService.cs b/Projects/VPKI/VPKI/VPKI.Web.Api/Services/VpkiBaseService.cs index 49b0c7b..43a10b5 100644 --- a/Projects/VPKI/VPKI/VPKI.Web.Api/Services/VpkiBaseService.cs +++ b/Projects/VPKI/VPKI/VPKI.Web.Api/Services/VpkiBaseService.cs @@ -219,7 +219,7 @@ namespace VPKI.Web.Api.Services // 프로세스 설정 string command = $"ocsp -issuer {subCaPath}{subCaFile} -CAfile {subCaPath}hkmcrootca.pem -cert {tempPath}{pcid}.pem -url {url} -text -timeout 3"; - Log4net.WriteLine($"{command}", LogType.Info); + Log4net.WriteLine($"{command}", LogType.Debug); ProcessStartInfo startInfo = new ProcessStartInfo { FileName = @$"{_configService?.GetConfig()?.Openssl?.Path}", // cmd.exe로 명령어 실행 diff --git a/Projects/VPKI/VPKI/VPKI.Web.Client/Services/ApiService.cs b/Projects/VPKI/VPKI/VPKI.Web.Client/Services/ApiService.cs index 511fad2..49eb636 100644 --- a/Projects/VPKI/VPKI/VPKI.Web.Client/Services/ApiService.cs +++ b/Projects/VPKI/VPKI/VPKI.Web.Client/Services/ApiService.cs @@ -44,12 +44,12 @@ namespace VPKI.Web.Client.Services httpClient.Timeout = new TimeSpan(0, 0, timeOutSec); httpClient.BaseAddress = new Uri($"{apiUrl}{url}"); - Log4net.WriteLine($"[POST] Request({guid})::{url}{Environment.NewLine}{request?.ToJson()}", LogType.Warn); + Log4net.WriteLine($"[POST] Request({guid})::{url}{Environment.NewLine}{request?.ToJson()}", LogType.HTTP); var res = await httpClient.PostAsJsonAsync(url, request); response = await res.Content.ReadFromJsonAsync(); - Log4net.WriteLine($"[POST] Rseponse({guid})::{url}{Environment.NewLine}{response?.ToJson()}", LogType.Warn); + Log4net.WriteLine($"[POST] Rseponse({guid})::{url}{Environment.NewLine}{response?.ToJson()}", LogType.HTTP); } catch (Exception e) { @@ -80,12 +80,12 @@ namespace VPKI.Web.Client.Services httpClient.Timeout = new TimeSpan(0, 0, timeOutSec); httpClient.BaseAddress = new Uri($"{apiUrl}{url}"); - Log4net.WriteLine($"[GET] Request({guid})::{url}{Environment.NewLine}", LogType.Warn); + Log4net.WriteLine($"[GET] Request({guid})::{url}{Environment.NewLine}", LogType.HTTP); var res = await httpClient.GetAsync(url); response = await res.Content.ReadFromJsonAsync(); - Log4net.WriteLine($"[GET] Rseponse({guid})::{url}{Environment.NewLine}{response?.ToJson()}", LogType.Warn); + Log4net.WriteLine($"[GET] Rseponse({guid})::{url}{Environment.NewLine}{response?.ToJson()}", LogType.HTTP); } catch (Exception e) {