-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a new logger for tooling console log entries from language workers so that they are always logged as Informational #8435
Conversation
…via standard output (Console.WriteLine) with Information level as the logging level so that the logging level set for Host is not affecting these log entries as they are being used by debuggers/IDEs
} | ||
|
||
internal WorkerConsoleLogService(ILogger logger, IWorkerConsoleLogSource consoleLogSource) | ||
internal WorkerConsoleLogService(ILogger logger, Lazy<ILogger> toolingConsoleJsonLoggerLazy, IWorkerConsoleLogSource consoleLogSource) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constructor is being used by UTs to inject test version of dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, only comment I have is around naming (see above comment)
@@ -49,7 +49,7 @@ public ILogger CreateLogger(string categoryName) | |||
|
|||
private bool IsUserLogCategory(string categoryName) | |||
{ | |||
return LogCategories.IsFunctionUserCategory(categoryName) || categoryName.Equals(WorkerConstants.FunctionConsoleLogCategoryName, StringComparison.OrdinalIgnoreCase); | |||
return LogCategories.IsFunctionUserCategory(categoryName) || categoryName.Equals(WorkerConstants.ConsoleLogCategoryName, StringComparison.OrdinalIgnoreCase); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reflecting the change of renaming the constant to remove the "Function" prefix.
Adding a new logger for tooling console log entries from language workers so that they are always logged as Informational irrespective of Host category level present in HOST.JSON
The dotnet language worker has a startup hook which emits some meta information about the language worker process (ex: processId). This information is emitted via standard output using Console.WriteLine API. The Host reads this std output stream and log that information using ILogger. We have a console logger which will print this in the console when in development mode, which IDE/Debuggers may read (the processId) so that they can attach to the process.
When the
host.JSON
of dotnet isolated function app specify "Error" as the minimum log level for "Host" category, this information is not surfaced to console as ILogger will discard any log message with level below "Error". The tooling console log messages are sent as "Information" level one and thus being dropped.The fix here in this PR is having a separate ILogger for the tooling related log messages coming from worker. We identify the tooling related messages by checking the existence of a special prefix(
azfuncjsonlog:
), and if detected, we will use the new logger for logging that message. This log level of this special logger is set toInformational
in code (Customers/Users are not supposed to change this), so that the log level value of "Host" category is not impacting this log entries.Relevant issue: Azure/azure-functions-dotnet-worker#900