修改测试
parent
6c8244d36c
commit
ebeef714b4
|
@ -4,7 +4,7 @@
|
||||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||||
autoReload="true"
|
autoReload="true"
|
||||||
throwExceptions="true"
|
throwExceptions="true"
|
||||||
internalLogLevel="Off" >
|
internalLogLevel="Off" >
|
||||||
|
|
||||||
<targets>
|
<targets>
|
||||||
<target xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}.log"
|
<target xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}.log"
|
||||||
|
|
|
@ -13,10 +13,24 @@ namespace IRaCIS.Core.API
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
ImageManager.SetImplementation(WinFormsImageManager.Instance);
|
ImageManager.SetImplementation(WinFormsImageManager.Instance);
|
||||||
|
var logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
logger.Debug("init main");
|
||||||
CreateHostBuilder(args).Build().Run();
|
CreateHostBuilder(args).Build().Run();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
//NLog: catch setup errors
|
||||||
|
logger.Error(exception, "Stopped program because of exception");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
|
||||||
|
NLog.LogManager.Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +52,7 @@ namespace IRaCIS.Core.API
|
||||||
{
|
{
|
||||||
logging.ClearProviders();
|
logging.ClearProviders();
|
||||||
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
|
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
|
||||||
}).UseSerilog()
|
}).UseNLog()
|
||||||
; // NLog: Setup NLog for Dependency injection;
|
; // NLog: Setup NLog for Dependency injection;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,9 +116,6 @@ namespace IRaCIS.Core.API
|
||||||
//});
|
//});
|
||||||
|
|
||||||
|
|
||||||
Log.Logger = new LoggerConfiguration()
|
|
||||||
.WriteTo.Console() // 选择日志输出目标,可以选择文件、数据库等
|
|
||||||
.CreateLogger();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +166,6 @@ namespace IRaCIS.Core.API
|
||||||
endpoints.MapControllers();
|
endpoints.MapControllers();
|
||||||
});
|
});
|
||||||
|
|
||||||
Log.Information("计费系统启动...");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue