Skip to content

Ability to get original Logger from activity.GetLogger(ctx) / workflow.GetLogger(ctx) #1954

@SovaPluto

Description

@SovaPluto

Is your feature request related to a problem? Please describe.
We have our own logger structure across all the services that has important features implemented through its methods.
Temporal logger injects some fields using With before execution of activity.
Another example is trace interceptor that also uses With to put trace/span ids as fields (key values).
The problem is that in some cases I receive not my Adapter structure, but "ReplayLogger". I can't extract original structure from ReplayLogger (it's private).
+ If other implementations/wrappers appear -- it will imposible to support.

Describe the solution you'd like
I want to have opportunity to get the original logger structure without losing all the fields injected previously.
So the solution can be EITHER, giving a method for getting my configured logger, passed at the configuration step, OR don't wrap the original logger anyhow during the execution (logger always keeps the same type, no decorators allowed).

Describe alternatives you've considered
Using global logger in case I couldn't assert type to my adapter. In this case I can lose important fields or must duplicate them myself from the activity. It's more complicated and expensive to do.

Additional context

How I try to get the original logger from the activity's context:
Image

GetLogger method represents "global" clean logger

Difference in execution:
Image

P.S: I'd gladly consider other solutions if you have such. The main goal is to be able to re-use SDK logger enhancements + to continue using project's standard implementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions