dotnet / orleans

Cloud Native application framework for .NET
https://docs.microsoft.com/dotnet/orleans
MIT License
10.07k stars 2.03k forks source link

Log a Fatal error in our Orleans system #2423

Closed gavinrunsdavies closed 7 years ago

gavinrunsdavies commented 7 years ago

We have a requirement to log Fatal error in our Orleans system, however the current options for Orleans.Runtime.Severity only allow three levels of severity and three of verbose. As Fatal is a common level in most logging frameworks e.g. NLog, Log4Net is there a chance that it can be incorporated in to the Orleans log levels?

Alternatively is there away to work around this?

sergeybykov commented 7 years ago

The log severities are defined as follows.

public enum Severity
{
        Off = 0,
        Error = 1,
        Warning = 2,
        Info = 3,
        Verbose = 4,
        Verbose2 = Verbose + 1,
        Verbose3 = Verbose + 2
}

It's easy to add Fatal as 7, but that would violate the implied relative order of the values that is used for filtering.

A potential alternative is to log Fatal as Error with error codes higher than a certain value or within a certain range of values, as a convention, an then convert them into Fatal within the telemetry/log consumer plugin for NLog/Log4Net.