Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormatException: String '2021-06-17 01:12:53,149' was not recognized as a valid DateTime. #75

Open
linv2 opened this issue Jun 16, 2021 · 2 comments

Comments

@linv2
Copy link

linv2 commented Jun 16, 2021

日志文件如下

2021-06-17 01:12:53,149 ||  INFO || Microsoft.Hosting.Lifetime || Application started. Press Ctrl+C to shut down. ||  ||end 
2021-06-17 01:12:53,240 ||  INFO || Microsoft.Hosting.Lifetime || Application started. Press Ctrl+C to shut down. ||  ||end 
2021-06-17 01:12:53,253 ||  INFO || Microsoft.Hosting.Lifetime || Hosting environment: Development ||  ||end 
2021-06-17 01:12:53,253 ||  INFO || Microsoft.Hosting.Lifetime || Hosting environment: Development ||  ||end 
2021-06-17 01:12:53,256 ||  INFO || Microsoft.Hosting.Lifetime || Content root path: D:\Code\dotnet\AmzErp\src\dotnet\AmzErp\AmzErp.Web ||  ||end 
2021-06-17 01:12:53,257 ||  INFO || Microsoft.Hosting.Lifetime || Content root path: D:\Code\dotnet\AmzErp\src\dotnet\AmzErp\AmzErp.Web ||  ||end 
2021-06-17 01:12:53,308 || DEBUG || AmzErp.Common.Mvc.Filters.RequestLoggerFilter || GET /user/test ||  ||end 
2021-06-17 01:12:53,313 || DEBUG || AmzErp.Common.Mvc.Filters.RequestLoggerFilter || GET /user/test ||  ||end 

官方示例log4net配置
<conversionPattern value="%date || %5level || %logger || %message || %exception ||end %newline" />
修改后正常运行的log4net配置
<conversionPattern value="%date{yyyy-MM-dd HH:mm:ss} || %5level || %logger || %message || %exception ||end %newline" />

@linv2
Copy link
Author

linv2 commented Jun 16, 2021

建议:在显示日志全文时,把日志内容放入<pre>节点内

@realLiangshiwei
Copy link
Owner

谢谢你的建议,重构时我会考虑

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants