我有一个 ASP.Net Core (.Net Core 1.1.1) 应用程序,它使用内置记录器并将Serilog.Extensions.Logging.File
日志写入文件,它在我的 macOS 开发环境中运行良好,但在 CentOS 环境中运行良好。
appsetting json:
"Logging": {
"IncludeScopes": false,
"PathFormat": "Logs/log-{Date}.log",
"RetainedFileCountLimit": 7,
"LogLevel": {
"Default": "Warning"
}
}
启动.cs:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) {
loggerFactory
.AddConsole(Configuration.GetSection("Logging"))
.AddFile(Configuration.GetSection("Logging"))
.AddDebug();
该Logs
目录不存在,我检查了以下内容:
- 应用程序文件夹所有者是
centos
- 应用程序服务
User
与centos
文件夹所有者相同 - 日志可用
journalctl
- 没有错误信息
我错过了什么吗?