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.

You can use it like this:

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

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

Nomirun Host is using Serilog to output to console and implements OpenTelemetry NuGet to output logs, metrics and traces to the storage of your choice. For logs, you can use Seq, for traces you can use Jaeger and for metrics you can use Prometheus.

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, follow the steps below. This includes defining the Otel.HostUrl configuration to connect the OTel Collector to the Nomrun 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.