Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.93k stars 440 forks source link

Add support for logging without invocation id #8304

Closed kshyju closed 2 years ago

kshyju commented 2 years ago

Currently, for out-of-process applications, logging happens only if the log message (RpcLog instance) is associated with an invocation id. We have use cases like below where logging without an invocation id is a valid use case.

  1. Logging using an ILogger\<T> instance does not work when it is not part of a function execution
  2. Add startup logger to log startup code failure

This is the code which checks the existence of invocation Id before executing the logging code, in host.

liliankasem commented 2 years ago

This is specifically for customer code right? For worker code, you can use the system category to log things without an ID

fabiocav commented 2 years ago

The key ask here is for the ability to send user level logs to the host. The mechanism we expose today enables infrastructure (worker) level logs to flow through, but doesn't apply to user level logs.

The work being done by @brettsam (Worker AI integration) should address this requirement, but this issue is also captured by #8222 . So we're closing this issue as a duplicate.

Link to the AI PR: https://github.com/Azure/azure-functions-dotnet-worker/pull/944