Documentation

Nomirun logging and telemetry

Nomirun SDK supports default frameworks ILogger<T> implementation.

The default implementation of ILogger<T> in ASP.NET leverages the dependency injection (DI) framework. By injecting an ILogger<T> into your classes or services, you can log information, warnings, errors, and other levels of messages conveniently.

Here is an example:

    public class MyClass
    {
        private readonly ILogger<MyClass> _logger;

        public MyClass(ILogger<MyClass> logger)
        {
            _logger = logger;
        }
        
        ...
    }

Nomirun Host uses Serilog to output to console and implements an OpenTelemetry NuGet to output logs, metrics and traces to the storage of your choice. To access these, you can use any relevant tools such as Seq (logs), Jaeger (traces), and Prometheus (metrics).

Logging to console

Nomirun Host has a known Serilog configuration defined in its configuration:

{
  "Nomirun.Host": {
    "Serilog": {
      "Using": [
        "Serilog.Sinks.Console"
      ],
      "MinimumLevel": {
        "Default": "Debug",
        "Override": {
          "Microsoft": "Debug",
          "System": "Debug"
        }
      }
    },
    ...
  }
}

You can easily configure the log levels in the configuration to suite your needs:

  1. Verbose:
    • The most detailed logging level.
    • Typically used for debugging, as it captures all information, including detailed internal application details.
    • Often too verbose for production environments.
  2. Debug:
    • Used to log information that may be helpful for debugging during development.
    • Less detailed than Verbose but still includes detailed app flow and state information.
  3. Information:
    • Used for general application flow and high-level progress tracking.
    • Represents essential and informational messages that are useful in understanding the operations of the application.
  4. Warning:
    • Indicates a potential issue or unexpected behavior that doesn’t immediately result in an error.
    • Helpful for identifying potential risks or problems in the future.
  5. Error:
    • Logs errors or exceptions that prevent part of the app’s functionality from working.
    • Indicates more serious issues that should be addressed.
  6. Fatal:
    • The highest severity level.
    • Logs critical errors that cause the application to crash or stop working entirely.
    • These logs often signal the need for immediate attention.

Open Telemetry

To set up an OpenTelemetry (OTel) Collector Docker image and configure its integration with the Nomrun host you need to define the Otel.HostUrl configuration which connects to the OTel Collector to the Nomirun Host.

Make sure the Nomrun Host configuration is updated to connect to the OTel Collector. For example:

{
   "Nomirun.Host": {
      "Otel": {
        "HostUrl": "http://otel-collector:4317"
      }
   }
}
  • HostUrl: Replace otel-collector.localhost with the hostname or IP address of your machine if needed.