Skip to content

Unable to override log level switch initial log level via environment variables #231

@frolyo

Description

@frolyo

Since we deploy our services in k8s we need to override level switch initial log level via environment variable. At the same time levelSwitchName must start with $ sign which is not allowed for env variable name.

How can initialLevel can be overriden?

Example:

  1. app config:
  "Serilog": {
    "levelSwitches": {
      "$logLevelSwitch": "Debug"
    },
    "MinimumLevel": {
      "controlledBy": "$logLevelSwitch"
...
  1. override:
env:
  name: serilog_levelSwitches_$logLevelSwitch
  value: Debug

Error:
"Invalid value: "serilog__levelSwitches__$logLevelSwitch": a valid environment variable name must consist of alphabetic characters, digits, '_', '-', or '.', and must not start with a digit"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions