Skip to content

[Bug] Activity logger context not populated when activity_info_on_message False #592

Closed
@TheCodeWrangler

Description

@TheCodeWrangler

What are you really trying to do?

I would like to have my logs include activity info on extra but not in the message

activity.logger.activity_info_on_message = False
activity.logger.activity_info_on_extra = True

However in practice after enabling a debugger when
https://github.com/temporalio/sdk-python/blob/main/temporalio/activity.py#L462
is reached the value of context._logger_details is None/null

Running the same debug again with

activity.logger.activity_info_on_message = True
activity.logger.activity_info_on_extra = True

results in the debugger showing that context._logger_details is populated

Describe the bug

It should be possible to include extra context on activities without including them in the string of the message however in practice it does not seem to work.

Minimal Reproduction

Prior to running hello world on running the workers

from temporal import activity

activity.logger.activity_info_on_message = False
activity.logger.activity_info_on_extra = True

Run an activity which inclues activity.logger.info("some message") and observe that the logger results in "temporal_activity": null

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions