-
Notifications
You must be signed in to change notification settings - Fork 74
Change_log_level #187
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
base: main
Are you sure you want to change the base?
Change_log_level #187
Conversation
5cfa4c5
to
598c1af
Compare
hello/hello_change_log_level.py
Outdated
return True | ||
|
||
|
||
logging.getLogger("temporalio.worker._workflow_instance").addFilter(CustomLogFilter()) |
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.
logging.getLogger("temporalio.worker._workflow_instance").addFilter(CustomLogFilter()) | |
logging.getLogger().addFilter(CustomLogFilter()) |
Can we add this to the root logger instead (untested)? There are no guarantees about how we may refactor internals.
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.
Thank you very much for catching this! I believe it is solved 👍
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.
May be able to add a test for this to confirm continued expected behavior (though I know we haven't always added tests for all samples)
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.
Thanks for keeping me honest!
Speaking of that, I vibe coded a test that that checks what we want: it passes with the code as-is, but it fails if I remove the sample's configuration to elevate the logging.
from temporalio.worker import Worker | ||
|
||
# --- Begin logging set‑up ---------------------------------------------------------- | ||
_WORKFLOW_TASK_FAILURE_LOG_PREFIX = "Failed activation on workflow" |
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.
@cretz I'm a little worried about this hardcoding cuz I'm not sure we guarantee this log message won't be modified.
- If it won't be modified, I think we don’t have anything to worry about
- if it could be modified, could we do something like expose a constant from the SDK? I recognize it might be a little goofy, but it might be more robust
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.
Yes, this is exactly why we just solved temporalio/sdk-python#864 last week. I'd wait until that is released (soon).
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.
Thanks @cretz! I see the new SDK was released and includes the fix (888). Judging by the files changed in the PR, this string didn’t change, correct? So the benefit of the PR is adding the test to reinforce the fact that this string is public API and won’t change? Meaning, the sample is still good? I know you said nothing blocking
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, nothing really blocking, but let's wait for the impending Python SDK release so you can use a more deliberate differentiator on the log record.
from temporalio.worker import Worker | ||
|
||
# --- Begin logging set‑up ---------------------------------------------------------- | ||
_WORKFLOW_TASK_FAILURE_LOG_PREFIX = "Failed activation on workflow" |
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.
Yes, this is exactly why we just solved temporalio/sdk-python#864 last week. I'd wait until that is released (soon).
hello/hello_change_log_level.py
Outdated
id="hello-workflow-id", | ||
task_queue="hello-task-queue", |
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.
Would recommend an ID and task queue named specifically for this sample
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.
Love it - fixed 👍
What was changed
Added a hello sample showing how to change the log level for workflow task failures
Why?
Some users have requested a sample on this.
Checklist
Any docs updates needed?
Updated the top-level readme and the hello readme
How was this tested:
Ran and confirmed that the log level was changed to error