Skip to content

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

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

Open
SovaPluto opened this issue May 11, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@SovaPluto
Copy link

SovaPluto commented May 11, 2025

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

@SovaPluto SovaPluto added the enhancement New feature or request label May 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant