admin 管理员组文章数量: 1086019
I try to log infos in my C# API
In the VS output window, everything works fine, I would get something like
Logger: Information: Some message A
Logger: Information: Some message B
Logger: Information: Some message C
As my api is deployed, the log goes completely insane
info: Logger[0]
Some message A
info: Logger[0]
Some message B
info: Logger[0]
Some message C
This is how I initialize my logger in my Program.cs
var app = builder.Build();
var loggerFactory = app.Services.GetRequiredService<ILoggerFactory>();
var logger = loggerFactory.CreateLogger("Logger");
logger.LogInformation("Some message A");
logger.LogInformation("Some message B");
logger.LogInformation("Some message C");
- How can I have more control to the log format ?
- How can I get rid of that Logger[0] and that useless carriage return ?
Would be great to have something like
[hh:mm:ss:msec] info: Some message A
EVEN when the app is deployed
Thanks for your help
本文标签: loggingCILoggerFactoryDeployed app adds a carriage return in the logStack Overflow
版权声明:本文标题:logging - C# - ILoggerFactory - Deployed app adds a carriage return in the log - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744045921a2524114.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论