Skip to content

Cannot create environment variable for logging category with periods #87130

@AnthonyMastrean

Description

@AnthonyMastrean

The logging configuration often uses namespaces (or namespace like strings, separated by periods) as category keys.

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

The logging and configuration docs agree on creating environment variables for deep configuration structures.

Logging__LogLevel__Microsoft=Information

But, you can't use a period in a variable or environment variable name in any shell that I know of. It's not disallowed by the spec, apparently, but the various shells seem to avoid period in their implementations.

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_10_02
https://tldp.org/LDP/abs/html/gotchas.html

# Logging__LogLevel__Microsoft.Hosting.Lifetime=Information
bash: Logging__LogLevel__Microsoft.Hosting.Lifetime=Information: command not found

So, how do we do this?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions