tanghai 7 лет назад
Родитель
Сommit
420bb59e27
2 измененных файлов с 11 добавлено и 11 удалено
  1. 7 7
      Server/App/NLog.config
  2. 4 4
      Server/App/Program.cs

+ 7 - 7
Server/App/NLog.config

@@ -13,7 +13,7 @@
 	<targets>
 		<target name="trace" xsi:type="File"
 			openFileCacheTimeout="3600"
-			fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}/Trace/${shortdate}.log"
+			fileName="${basedir}/../Logs/Log-${var:appType}-${var:appIdFormat}-Trace-${date:universalTime=true:format=yyyyMMdd}.log"
 			deleteOldFileOnStartup="false"
 			layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message} ${newline} ${stacktrace:format=Raw:topFrames=10:skipFrames=0}" />
 	</targets>
@@ -21,7 +21,7 @@
 	<targets>
 		<target name="debug" xsi:type="File"
 			openFileCacheTimeout="3600"
-			fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}/Debug/${shortdate}.log"
+			fileName="${basedir}/../Logs/Log-${var:appType}-${var:appIdFormat}-Debug-${shortdate}.log"
 			deleteOldFileOnStartup="false"
 			layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message}" />
 	</targets>
@@ -29,7 +29,7 @@
 	<targets>
 		<target name="info" xsi:type="File"
 			openFileCacheTimeout="3600"
-			fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}/Info/${shortdate}.log"
+			fileName="${basedir}/../Logs/Log-${var:appType}-${var:appIdFormat}-Info-${date:universalTime=true:format=yyyyMMdd}.log"
 			deleteOldFileOnStartup="false"
 			layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message}" />
 	</targets>
@@ -37,7 +37,7 @@
 	<targets>
 		<target name="error" xsi:type="File"
 			openFileCacheTimeout="3600"
-			fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}/Error/${shortdate}.log"
+			fileName="${basedir}/../Logs/Log-${var:appType}-${var:appIdFormat}-Error-${date:universalTime=true:format=yyyyMMdd}.log"
 			deleteOldFileOnStartup="false"
 			layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message} ${newline} ${stacktrace:format=Raw:topFrames=10:skipFrames=0}" />
 	</targets>
@@ -45,7 +45,7 @@
   <targets>
 		<target name="warn" xsi:type="File"
 			openFileCacheTimeout="3600"
-			fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}/Warning/${shortdate}.log"
+			fileName="${basedir}/../Logs/Log-${var:appType}-${var:appIdFormat}-Warning-${date:universalTime=true:format=yyyyMMdd}.log"
 			deleteOldFileOnStartup="false"
 			layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message}" />
 	</targets>
@@ -53,13 +53,13 @@
   <targets>
 		<target name="fatal" xsi:type="File"
 			openFileCacheTimeout="3600"
-			fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}/Fatal/${shortdate}.log"
+			fileName="${basedir}/../Logs/Log-${var:appType}-${var:appIdFormat}-Fatal-${date:universalTime=true:format=yyyyMMdd}.log"
 			deleteOldFileOnStartup="false"
 			layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message} ${newline} ${stacktrace:format=Raw:topFrames=10:skipFrames=0}" />
 	</targets>
 	
 	<rules>
-		<logger name="*" minlevel="Trace" writeTo="all" />
+		<!--<logger name="*" minlevel="Trace" writeTo="all" />-->
 		<logger name="*" minlevel="Trace" maxlevel="Trace" writeTo="trace" />
 		<logger name="*" minlevel="Debug" maxlevel="Debug" writeTo="debug" />
 		<logger name="*" minlevel="Info" maxlevel="Info" writeTo="info" />

+ 4 - 4
Server/App/Program.cs

@@ -28,10 +28,10 @@ namespace App
 
 				IdGenerater.AppId = options.AppId;
 
-				LogManager.Configuration.Variables["appType"] = startConfig.AppType.ToString();
-				LogManager.Configuration.Variables["appId"] = startConfig.AppId.ToString();
-				LogManager.Configuration.Variables["appTypeFormat"] = $"{startConfig.AppType,-8}";
-				LogManager.Configuration.Variables["appIdFormat"] = $"{startConfig.AppId:D3}";
+				LogManager.Configuration.Variables["appType"] = $"{startConfig.AppType}";
+				LogManager.Configuration.Variables["appId"] = $"{startConfig.AppId}";
+				LogManager.Configuration.Variables["appTypeFormat"] = $"{startConfig.AppType, -8}";
+				LogManager.Configuration.Variables["appIdFormat"] = $"{startConfig.AppId:0000}";
 
 				Log.Info($"server start........................ {startConfig.AppId} {startConfig.AppType}");