KEMBAR78
Allow setting logger output format with TORCH_LOGS_FORMAT by oulgen · Pull Request #111770 · pytorch/pytorch · GitHub
Skip to content

Conversation

@oulgen
Copy link
Contributor

@oulgen oulgen commented Oct 23, 2023

Stack from ghstack (oldest at bottom):

TORCH_LOGS_FORMAT="%(levelname)s: %(message)s" will only dump output
level and message contents

TORCH_LOGS_FORMAT="%(levelname)s: %(message)s" will only dump output
level and message contents

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 23, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/111770

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit bef7a8b with merge base 2b2b6ca (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

TORCH_LOGS_FORMAT="%(levelname)s: %(message)s" will only dump output
level and message contents

[ghstack-poisoned]
@oulgen oulgen added the topic: not user facing topic category label Oct 23, 2023
if fmt is None:
return TorchLogsFormatter()
else:
return logging.Formatter(fmt)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the formatter is invalid, what kind of error do we get?

Copy link
Contributor Author

@oulgen oulgen Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, we throw a ValueError: Formatting field not found in record error. We could find a way to validate it but not sure how valuable/easy it would be.

@voznesenskym
Copy link
Collaborator

voznesenskym commented Oct 23, 2023

I get the desire to want to make it general purpose, but it really just seems like you want all annotations, or none (just the message). This would make it much simpler to understand, and harder to set wrong.

@oulgen
Copy link
Contributor Author

oulgen commented Oct 23, 2023

@voznesenskym This is customizable enough to appease all different opinions, which is why i went with this version. There was not a consensus around simpler versions. Since this is not a publicly announced API, it should be okay to be less precise/hardened around it. What do you think?

@Chillee
Copy link
Collaborator

Chillee commented Oct 23, 2023

I wonder whether we should turn the default to not have that info

@oulgen
Copy link
Contributor Author

oulgen commented Oct 23, 2023

@Chillee I proposed that but @voznesenskym was against it. It will probably be hard to get consensus on something like this.

TORCH_LOGS_FORMAT="%(levelname)s: %(message)s" will only dump output
level and message contents

[ghstack-poisoned]
oulgen added a commit that referenced this pull request Oct 23, 2023
TORCH_LOGS_FORMAT="%(levelname)s: %(message)s" will only dump output
level and message contents

ghstack-source-id: e206afb
Pull Request resolved: #111770
@oulgen
Copy link
Contributor Author

oulgen commented Oct 23, 2023

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 23, 2023
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

pytorchmergebot pushed a commit that referenced this pull request Oct 24, 2023
@facebook-github-bot facebook-github-bot deleted the gh/oulgen/11/head branch October 27, 2023 14:25
xuhancn pushed a commit to xuhancn/pytorch that referenced this pull request Nov 7, 2023
…1770)

TORCH_LOGS_FORMAT="%(levelname)s: %(message)s" will only dump output
level and message contents
Pull Request resolved: pytorch#111770
Approved by: https://github.com/jansel
xuhancn pushed a commit to xuhancn/pytorch that referenced this pull request Nov 7, 2023
xuhancn pushed a commit to xuhancn/pytorch that referenced this pull request Nov 7, 2023
Skylion007 pushed a commit to Skylion007/pytorch that referenced this pull request Nov 14, 2023
…1770)

TORCH_LOGS_FORMAT="%(levelname)s: %(message)s" will only dump output
level and message contents
Pull Request resolved: pytorch#111770
Approved by: https://github.com/jansel
Skylion007 pushed a commit to Skylion007/pytorch that referenced this pull request Nov 14, 2023
Skylion007 pushed a commit to Skylion007/pytorch that referenced this pull request Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants