最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

asp.net core - How to write message with warning priority to Debian journal - Stack Overflow

programmeradmin0浏览0评论

I have an ASP.NET Core 9 application controller that logs messages with warning level in Debian 12:

public class ContextLessLogger(ILogger syslog)
{
    public Log() 
    {
        syslog.Log(LogLevel.Warning, "test");
    }
}

Filtering messages by warning priority produces no results:

 journalctl -t MyApp -n 100 -p warning
-- No entries --

If priority filter is removed, entries are shown:

journalctl -t MyApp -n 100

produces

veebr 09 14:33:04 uvn-xxxxx.eu MyApp[3659254]: warn: Service.ContextLessLogger[0]
veebr 09 14:33:04 uvn-xxxxx.eu MyApp[3659254]:       test   

It looks like .NET 9 does not write warning log level to Linux log journal. How to fix this so that messages can filtered by warning priority?

Using journal based logging which is used by default in Debian 12.

发布评论

评论列表(0)

  1. 暂无评论