Fix logs still appearing even when LogLevel is set to none bug#3318
Fix logs still appearing even when LogLevel is set to none bug#3318RubenCerna2079 wants to merge 23 commits intomainfrom
none bug#3318Conversation
|
/azp run |
|
/azp run |
|
/azp run |
Aniruddh25
left a comment
There was a problem hiding this comment.
Not clear how using different LogBuffer is helping to fix CLI logs being outputed even after LogLevel is set to None.
src/Cli/ConfigGenerator.cs
Outdated
| { | ||
| if (cliBuffer is not null) | ||
| { | ||
| cliBuffer.BufferLog(logLevel, message, ex); |
There was a problem hiding this comment.
Why do we need this helper method? The caller is anyway passing both the logger and the logbuffer to this function. Its not like the caller is unaware, if the CliBuffer is null or not, if its a static member that you initialize then it is always going to be valid. You can simply call the BufferLog in the caller itself.
There was a problem hiding this comment.
There are some places where we use it where it is not always necessary as the loggers have already been initialized properly, so we pass the LogBuffer as a null so that it directly logs the message. I will also add this to the description to make it easier to understand.
There was a problem hiding this comment.
In those other callers, where the logger directly logs - you can simply use logger.Log. There you dont need the buffer.
This wrapper is unnecessary, we can simply either flush to buffer or do logger.log in the respective callers.
That way, its easier to read as well - otherwise, in the various callers - the reader is unaware what is going to happen unless they look into the function definition.
none bug
I do not understand this. |
|
If we use different LogBuffers for different classes, wouldn't the logs get out of place as we will be flushing the log buffers in a different order of collecting the logs. |
Aniruddh25
left a comment
There was a problem hiding this comment.
Why does the description say we want to fix logs only from dab start? Why not the other commands?
…loglevel-bugs' into dev/rubencerna/fix-loglevel-bugs
Why make this change?
Closes issue [Bug]: Startup class logger is not properly initialized #3262
The logger for the Startup class is not initialized properly, since this logger is special due to the nature of the Startup class it needs to be continuously updated as DAB initializes. This causes two problems:
Closes issue [Bug]: CLI logs being outputed even after LogLevel is set to none #3256 & [Bug]:
log-levelseems like it is not working when two in config. #3255The CLI logger still outputs some logs even when the LogLevel is set to
none. It is expected that if the LogLevel set isnoneor some other level that shouldn't output theinformationlevel, the logs will not appear.What is this change?
In order to solve issue #3262:
Startup.cs, this is necessary since we wanted each class to have its own LogBuffer so that we are able to tell from which logger the logs are being outputted.Startuplogger by changing the method that it was using to initialize the logger, it now usesCreateLoggerFactoryForHostedAndNonHostedScenariowhich checks if there are any LogLevel namespaces from the config file that can be applicable for the specific logger. It is important to note that there are multiple places where the logs are flushed in order to cover for the cases in which an exception is found and causes DAB to end abruptly, and when we there is an IsLateConfigured scenario.In order to solve issue #3256 & #3255:
StartOptions.csuntil it is able to deserialize the RuntimeConfig and find which level to set theLogLevelin order to flush all the logs.dab startcommand, which is why we only make this change in theStartOptions.csfile, on the functionTryStartEngineWithOptionsinside ofConfigGenerator.cs, and a few functions fromUtils.csandConfigMerger.csthat are used inside theTryStartEnginefunction.How was this tested?
Sample Request(s)