2

In .NET you sometimes need configuration keys with dots. For example in logging configuration. .NET itself creates a sample like this (Microsoft.AspNetCore):

"Logging": {
  "LogLevel": {
    "Default": "Information",
    "Microsoft.AspNetCore": "Warning"
  }
}

Is there a way to set this value with an environment variable?

I tried:

  • Logging__LogLevel__Microsoft.AspNetCore
  • Logging__LogLevel__MicrosoftAspNetCore
  • Logging__LogLevel__Microsoft_AspNetCore
  • Logging__LogLevel__Microsoft__AspNetCore

Nothing worked. I know that dots in environment variables are not allowed in Linux. But here Microsoft (.NET) dictates it.

1 Answer 1

0

This is an unresolved issue in ASP.NET which was first reported in 2019:

There is a workaround which allows '___' (triple underscore) to be used instead of '.' (link)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.