Bladeren bron

1.設定 外部Auth Service Log

Jessica Tseng 3 jaren geleden
bovenliggende
commit
5973f116a1

+ 3 - 3
EVCB_OCPP.WSServer/Message/CoreProfileHandler.cs

@@ -469,7 +469,7 @@ namespace EVCB_OCPP.WSServer.Message
                                         }
                                     }
                                 }
-                            
+
                             }
 
                             //特例****飛宏客戶旗下的電樁,若遇到Portal沒回應的狀況 ~允許充電
@@ -709,7 +709,7 @@ namespace EVCB_OCPP.WSServer.Message
                                 var authorization_result = await businessService.Authorize(session.ChargeBoxId, _request.idTag);
                                 confirm.idTagInfo = authorization_result.IdTagInfo;
 
-                                if(authorization_result.ChargePointFee!=null)
+                                if (authorization_result.ChargePointFee != null)
                                 {
                                     var price = authorization_result.ChargePointFee.Where(x => x.IsAC == session.IsAC).First();
                                     if (price != null)
@@ -738,7 +738,7 @@ namespace EVCB_OCPP.WSServer.Message
                                         }
                                     }
                                 }
-                               
+
                             }
                             //特例****飛宏客戶旗下的電樁,若遇到Portal沒回應的狀況 ~允許充電
                             if (session.CustomerId.ToString().ToUpper() == "8456AED9-6DD9-4BF3-A94C-9F5DCB9506F7" && confirm.idTagInfo.status == AuthorizationStatus.ConcurrentTx)

+ 3 - 1
EVCB_OCPP.WSServer/NLog.config

@@ -32,7 +32,8 @@
             layout="${longdate} ${uppercase:${level}} ${message}" />
     <target xsi:type="Console" name="Console"
             layout="${longdate} ${uppercase:${level}} ${message}" />
- 
+    <target xsi:type="File" name="auth" fileName="${basedir}/logs/Auth_${shortdate}.log"
+              layout="${longdate} ${uppercase:${level}} ${message}" />
  
   </targets>
   <rules>
@@ -42,6 +43,7 @@
     Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace)  to "f"
     <logger name="*" minlevel="Debug" writeTo="f" />
     -->
+    <logger name="EVCB_OCPP.WSServer.Service.OuterBusinessService" level="Info" writeTo="auth" />
     <logger name="*" minlevel="Debug" writeTo="f" />
     <logger name="*" minlevel="Trace" writeTo="Console" />
   </rules>

+ 1 - 1
EVCB_OCPP.WSServer/Properties/AssemblyInfo.cs

@@ -35,4 +35,4 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyVersion("1.0.5.0")]
 [assembly: AssemblyFileVersion("1.0.5.0")]
 
-[assembly: AssemblyInformationalVersion("3ae218b")]
+[assembly: AssemblyInformationalVersion("381f361")]

+ 5 - 6
EVCB_OCPP.WSServer/Service/OuterBusinessService.cs

@@ -64,22 +64,21 @@ namespace EVCB_OCPP.WSServer.Service
 
             try
             {
-
                 string requestParams = string.Format("charging_auth?ChargeBoxId={0}&IdTag={1}", chargeBoxId, idTag);
 
-                if (CustomerId.ToLower() == "9e6bfdcc-09fb-4dab-a428-43fe507600a3")
+               // if (CustomerId.ToLower() == "9e6bfdcc-09fb-4dab-a428-43fe507600a3")
                 {
-                    logger.Error(chargeBoxId + " Charging Monitor======================================>");
-                    logger.Error(signMaterial.APIUrl + requestParams);
+                    logger.Info(chargeBoxId + " Charging Monitor======================================>");
+                    logger.Info(signMaterial.APIUrl + requestParams);
                 }
                 var response = await httpClient.Post(signMaterial.APIUrl + requestParams, new Dictionary<string, string>()
                             {
                                 { "PartnerId",signMaterial.Id}
 
                             }, null, signMaterial.SaltKey).ConfigureAwait(false);
-                if (CustomerId.ToLower() == "9e6bfdcc-09fb-4dab-a428-43fe507600a3")
+               // if (CustomerId.ToLower() == "9e6bfdcc-09fb-4dab-a428-43fe507600a3")
                 {
-                    logger.Error(JsonConvert.SerializeObject(response));
+                    logger.Info(JsonConvert.SerializeObject(response));
                 }
                 if (response.Success)
                 {