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 }}
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
The second issue is a few lines later, it actually throws an exception whenever it cannot parse the enum.
elseif(Enum.TryParse<LogLevel>(value,outlevel)){returntrue;}else{varmessage=$"Configuration value '{value}' for category '{name}' is not supported.";thrownewInvalidOperationException(message);}
I think that's bad.
For the initial application startup, this might be fine, but if you work with reload tokens, the whole logic blows up if you make one mistake one time:
If the configuration has been updated with a wrong configuration value, the token triggers but the code above throws an exception. The exception doesn't get logged or shown anywhere because it's an async "somewhere" task doing the checks...
Because of the exception, no new token and handler get created afterwards, and I have to restart the application to have it read the updated configuration again...
The text was updated successfully, but these errors were encountered:
We need to add a finally or something to the logger providers that handle change tokens (like Console). They appear to already have the logic to reset the token, it just gets skipped on an exception.
I think the ideal experience here would be that if any errors occur during reloading of configuration we leave everything as it was before the config was changed, so none of your changes apply until you fix whatever is breaking and then all of them take affect. The reason I think that is because we should also log the fact that an error happened and it seems most likely to be log successfully if we ignore all the changes that caused an exception.
There are two catches which might be intended or not
First, the values in the configuration are parsed case sensitive. If you put "error" in lower case, you'll get an exception.
This could easily be changed by calling Enum.Parse(, true, ...) instead of
in ConfigurationConsoleLoggerSettings line 65
The second issue is a few lines later, it actually throws an exception whenever it cannot parse the enum.
I think that's bad.
For the initial application startup, this might be fine, but if you work with reload tokens, the whole logic blows up if you make one mistake one time:
If the configuration has been updated with a wrong configuration value, the token triggers but the code above throws an exception. The exception doesn't get logged or shown anywhere because it's an async "somewhere" task doing the checks...
Because of the exception, no new token and handler get created afterwards, and I have to restart the application to have it read the updated configuration again...
The text was updated successfully, but these errors were encountered: