SunPoint IT Solutions

Loading...

Blog

Serilog is a popular .NET logging library

Serilog is a diagnostic log library for .NET applications. It`s easy to set up, also has a clean API, and works on all the latest .NET platforms. Serilog`s structured logging support is effective for instrumentation of complex, distributed and asynchronous applications and systems. Serilog uses message templates and a simple DSL to help extend the .NET format string with named and positional parameters. Rather than immediately converting events to text, Serilog captures the values ​​associated with each named parameter. Consider an example in a log event, two properties are written: Position and Elapsed. The @ operator in front of Position indicates the Serilog object passed in, rather than converting it using ToString (). Serilog`s support for structured event data opens up a huge range of diagnostic capabilities that are not available with traditional recorders. Server components record structured event data, which makes it possible to search and analyze logs without parsing the logs or using regular expressions. Support for structured data is not a rejection of text: Serilog writes events to files or the console, the template and properties are mapped to human-readable text. Functions: - Community supported and actively developed - Logging API based on formats with familiar levels like debug, info, warning, error, etc.; - Discoverable C # configuration syntax and additional XML or JSON support; - Effective when enabled, low overhead when the logging level is disabled; - Best-in-class .NET Core support, includes extensive integration with ASP.NET Core; - Receiver support including files, console, on-premises and cloud log servers, databases, and message queues; - Complex content of log events with contextual information such as scoped properties (LogContext), thread and process IDs, and domain-specific correlation IDs such as HttpRequestId; - Zero shared state logger objects, with an optional global static log class; - A format independent logging pipeline, capable of generating events in plain text, JSON, in-memory LogEvent objects (including Rx pipelines), and other formats. Parameters: MinimumBreadcrumbLevel - LogLevel indicates the minimum level at which the log message should be included as navigation. By default, this value is Information. MinimumEventLevel-LogLevel, which indicates the minimum level at which a log message should be sent to Sentry as an event. By default, this value is Error. InitializeSdk - This integration should initialize the SDK. If you want to call SentrySdk.Init yourself, you must set this flag to false. Standard Log Properties - Property Name - Description: - ApplicationName (Name of the Application); - ClientIP (IP Address of the client the request originated from); - CorrelationId (ID that can be used to trace request across multiple application boundaries); - Elapsed (TIme in milliseconds an operation takes); - EventType (Hash of the message template to determine the message type); - MachineName (Name of the machine which application is running); - Outcome (The result of the operation); - RequestMethod (HTTP request method name); - RequestPath (Http request path); - SourceContext (Name of component/class which the log originated); - StatusCode (Http status code); - UserAgent (Http User Agent); - Version (Version of the application).

LATEST POSTS