调整日志
This commit is contained in:
parent
e37939e82b
commit
578f73a23a
|
|
@ -24,7 +24,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="wwwroot\html\" />
|
<Folder Include="wwwroot\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -127,9 +127,10 @@ public static class Program
|
||||||
{
|
{
|
||||||
//获取作IOC作用域对象
|
//获取作IOC作用域对象
|
||||||
var appServive = s.GetService<IHttpContextAccessor>();
|
var appServive = s.GetService<IHttpContextAccessor>();
|
||||||
|
var log = s.GetService<Serilog.ILogger>();
|
||||||
// var obj = appServive?.HttpContext?.RequestServices.GetService<Log>();
|
// var obj = appServive?.HttpContext?.RequestServices.GetService<Log>();
|
||||||
// Console.WriteLine("AOP" + obj.GetHashCode());
|
// Console.WriteLine("AOP" + obj.GetHashCode());
|
||||||
Console.WriteLine($"{appServive?.HttpContext?.Request.Path}:{sql}\r\n{pars}");
|
log?.Debug($"{appServive?.HttpContext?.Request.Path}:{sql}\r\n{pars}");
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
sqlSugar.DbMaintenance.CreateDatabase();
|
sqlSugar.DbMaintenance.CreateDatabase();
|
||||||
|
|
@ -148,6 +149,8 @@ public static class Program
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Log.Logger.Information($"Load file -> {file}...");
|
Log.Logger.Information($"Load file -> {file}...");
|
||||||
var assembly = Assembly.LoadFile(file);
|
var assembly = Assembly.LoadFile(file);
|
||||||
|
|
@ -175,11 +178,17 @@ public static class Program
|
||||||
// }
|
// }
|
||||||
Log.Logger.Information("done.\r\n");
|
Log.Logger.Information("done.\r\n");
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Logger.Error(ex, $"Load file -> {file} error.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (System.Exception ex)
|
catch (System.Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex.ToString());
|
Console.WriteLine(ex.ToString());
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"MinimumLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Debug",
|
"Default": "Information",
|
||||||
"Override": {
|
"Override": {
|
||||||
"Microsoft.AspNetCore.Mvc": "Debug",
|
"Microsoft.AspNetCore.Mvc": "Information",
|
||||||
"Microsoft.AspNetCore.Routing": "Debug",
|
"Microsoft.AspNetCore.Routing": "Information",
|
||||||
"Microsoft.AspNetCore.Hosting": "Debug"
|
"Microsoft.AspNetCore.Hosting": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"WriteTo": [
|
"WriteTo": [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue