You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LogLevel Filter by Category may be not working on Linux (AppServices) when dots in CategoryName are replaced by underscore #60534
May be I'm doing something wrong, so any help is welcome....
I have up and running a asp net core app (5.0.11) with Microsoft.Extensions.Logging in place
(a really small default configuration).
The issue occurs only on my Azure AppService Alpine (Linux!) instance!
I like to change logfilter by category for debugging and tracing....
I have category hierarchies like "A.B.C.D"
I like to filter for parts of the hierarchs like "A.B" or "A.B.C"
I'm able to change loglevel behavior via appsettings,json without problems for "A.B" on Linux and Windows
I'm able to change loglevel behavior via Environment variables in Visual Studio (Windows) without problems for "A.B"
I'm able to change loglevel behavior via Environment variable on Linux for Category "A" (without dot)
I'm NOT able to change loglevel behavior via Environmnet Variable on Linux for Category "A.B" (DOT part of the hierarchy!
I know that Linux has different behavior in Environment variables
=> ":" translated into double-underscore => works!
=> "." translated into single-underscore => seems to have NO impact to the LogFilter engine...
I'm using IConfigurationRoot.DebugView to print out my logging configuration.
and it looks in the following way:
(same behavior for Console and ApplicationInsights)
for me it looks like the "_" must be re-translated somewhere into "." before it goes into the LoggerRuleSelector
May be this is a known bug (i remember a few not solvable issues in core 2.0 and 3)
regards
Werner
Reproduction Steps
asp net core app with logging in place (console logging should be enough)
EnvironmentLoggerProvider should be included (using default logger builder)
set logging default to "Warning" or "Information" via appsettings (not other settings needed)
try to set LogFilter to Trace for a categoryName that CONTAINS "." ON LINUX (Alpine asp net core 5 runtime container) VIA ENVIRONMENT Variable
Expected behavior
LogFilter should be working
Actual behavior
LogFilter Ignored
Regression?
No response
Known Workarounds
No response
Configuration
asp-net-core 5 runtime alpine container hosted as Azure App Service
Other information
No response
Reacted by Gioacchino Piazzolla
Activity
ghost added
untriagedNew issue has not been triaged by the area owner
That's okay.
However, before adding the "ZiggyCreatures.Caching.Fusion.FusionCache": "Warning" line, we tried to reduce the log verbosity via the Azure Portal, using Configuration > Application settings (environment variables).
We attempted several combinations (using ., _ and __), but none of them worked.
This one actually worked, and reduced the log level for FusionCache.
As a final fix, we're configuring the full logger category inside appsettings.json.
However, the behavior we observed when using environment variables in the Azure Portal is quite subtle and could easily lead to confusion or misconfiguration.
Issue is not specific to logging, but Configuration. It is more or less same as #35989 and #87130. Despite it is hard to solve without breaking change or questionable API change, people found suitable workarounds for this issue.
First suitable workaround was briefly documented in Note section of Logging docs and linked StackOverflow thread. Workaround requires control over environment but do not require change to application code.
Different suitable workaround is described in comment #87130 (comment). This workaround in opposition do not requires significant changes in env setting, except using env vars with specific dot replacement. However it does requires code change.
I think talking about "breaking changes" is a terrible excuse. This fix could easily be introduced with an optional parameter in the configuration, so nothing breaks.
How should the optional parameter look? Please feel free to propose an API that would solve this issue. The biggest problem I see is that we lose information by replacing the dots. That loss then prevents us from distinguishing between what was originally a dot and what was an actual underscore.
Here is the API can be used to address this issue nicely:
Proposal
namespaceMicrosoft.Extensions.Configuration.EnvironmentVariables{publicpartialclassEnvironmentVariablesConfigurationSource:IConfigurationSource{// NEW: A string that, when found in env var keys, is replaced with "."// Default is null (no replacement, backward compatible)publicstring?DotReplacement{get;set;}}}// EnvironmentVariablesConfigurationProvider — new constructor overloadnamespaceMicrosoft.Extensions.Configuration.EnvironmentVariables{publicpartialclassEnvironmentVariablesConfigurationProvider:ConfigurationProvider{// NEWpublicEnvironmentVariablesConfigurationProvider(string?prefix,string?dotReplacement){}}}
How should the optional parameter look? Please feel free to propose an API that would solve this issue. The biggest problem I see is that we lose information by replacing the dots. That loss then prevents us from distinguishing between what was originally a dot and what was an actual underscore.
Avoiding "home-made" solutions, should be possible to resolve this calling a MS's solution... for example with a key in the AppService's Env variables called (for example) "ResolveDotsForConfiguration":true
Activity
WernerMairl commentedon Oct 18, 2021
label: area-Extensions-Logging
label: area-Extension-Configurations
sorry may be i have created a duplicate for this:
#35989
but we should find a solution or at least a better documentation....
jeffhandley commentedon Oct 18, 2021
Tagging @maryamariyan since the bot didn't.
maryamariyan commentedon Nov 3, 2021
Is it
_or double underscore__?Would be good if you could please share a repro sample to help try the different cases you shared here.
pavel-agarkov commentedon Sep 4, 2023
Hi, we cannot provide log levels via Azure AppService -> Configuration -> Application settings
since as stated in the documentation
https://learn.microsoft.com/en-us/azure/app-service/configure-common?tabs=portal
For example according to the documentation
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-7.0
we need to provide the following environment variable: Logging__Console__LogLevel__Microsoft.Hosting.Lifetime
but dots are replaced with underscores so logging level is not applied.
Are there any workarounds for this issue?
tarekgh commentedon Sep 13, 2023
@pavel-agarkov can you try the workaround mentioned in the comment #87130 (comment)
pavel-agarkov commentedon Sep 13, 2023
@tarekgh yes, we did something similar to that already. thank you.
gioce90 commentedon Jul 10, 2025
We’re experiencing the same issue.
Recently, we added FusionCache to our web app hosted on an Azure App Service (Linux).
When we configure logging directly in
appsettings.json, everything works as expected:That's okay.
However, before adding the "ZiggyCreatures.Caching.Fusion.FusionCache": "Warning" line, we tried to reduce the log verbosity via the Azure Portal, using Configuration > Application settings (environment variables).
We attempted several combinations (using
.,_and__), but none of them worked.Then I suspected that the issue might be related to the dot (
.) in the category name. So we tried:This one actually worked, and reduced the log level for FusionCache.
As a final fix, we're configuring the full logger category inside
appsettings.json.However, the behavior we observed when using environment variables in the Azure Portal is quite subtle and could easily lead to confusion or misconfiguration.
mrek-msft commentedon Feb 11, 2026
Issue is not specific to logging, but Configuration. It is more or less same as #35989 and #87130. Despite it is hard to solve without breaking change or questionable API change, people found suitable workarounds for this issue.
First suitable workaround was briefly documented in Note section of Logging docs and linked StackOverflow thread. Workaround requires control over environment but do not require change to application code.
Different suitable workaround is described in comment #87130 (comment). This workaround in opposition do not requires significant changes in env setting, except using env vars with specific dot replacement. However it does requires code change.
mrek-msft commentedon Feb 12, 2026
Triage: Discussed in team triage and we think there is no additional action needed.
gioce90 commentedon Feb 13, 2026
I think talking about "breaking changes" is a terrible excuse. This fix could easily be introduced with an optional parameter in the configuration, so nothing breaks.
rosebyte commentedon Feb 13, 2026
How should the optional parameter look? Please feel free to propose an API that would solve this issue. The biggest problem I see is that we lose information by replacing the dots. That loss then prevents us from distinguishing between what was originally a dot and what was an actual underscore.
tarekgh commentedon Feb 13, 2026
Here is the API can be used to address this issue nicely:
Proposal
Usage:
Alternative design
This is more flexible but less discoverable.
I added the same proposal to #35989 description too. Will be good to follow up there.
gioce90 commentedon Feb 13, 2026
Avoiding "home-made" solutions, should be possible to resolve this calling a MS's solution... for example with a key in the AppService's Env variables called (for example) "ResolveDotsForConfiguration":true
Is just an idea.