-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix for multiline errors when writing to log files #1953
Fix for multiline errors when writing to log files #1953
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
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.
I'm not sure if either of these are right.
One is difficult to parse as some lines are log messages, some are continuations.
The other suggests there were two errors.
Maybe lines should be joined?
What would your desired output look like? |
Hmm, I'm not too sure. I'm not really familiar with log format conventions but I'm assuming trying to put multiline messages in a log might be frowned upon in the first place 😅. I would think you'd want to keep to one message (even if it is long/multiline) per line in the logfile though. |
If you really want to emit structured logs, we should probably be giving JSON output... |
I'm wondering whether we ought to do something like this instead?
possibly combined with replacing
with
in our own code? |
That's what I would have done as a first solution. Then see if very long lines become a big problem. I suppose if would mean if you want to look through many lines you need an extra tool or bit of processing. With tracebacks, I don't know if we need to print the previous exception in the new exception's message. |
Agreed - the insertion of newlines was done to ensure we got informative errors while skipping a full traceback. Note that other libraries (notably pydantic) also produce multiline errors, but we don't need to be doing it ourselves. I can update this PR next week - unless you want to do it as part of fixing logging? |
data_safe_haven/infrastructure/components/dynamic/blob_container_acl.py
Outdated
Show resolved
Hide resolved
data_safe_haven/infrastructure/components/dynamic/blob_container_acl.py
Outdated
Show resolved
Hide resolved
data_safe_haven/infrastructure/components/dynamic/entra_application.py
Outdated
Show resolved
Hide resolved
data_safe_haven/infrastructure/components/dynamic/entra_application.py
Outdated
Show resolved
Hide resolved
data_safe_haven/infrastructure/components/dynamic/entra_application.py
Outdated
Show resolved
Hide resolved
data_safe_haven/infrastructure/components/dynamic/entra_application.py
Outdated
Show resolved
Hide resolved
data_safe_haven/infrastructure/components/dynamic/file_share_file.py
Outdated
Show resolved
Hide resolved
data_safe_haven/infrastructure/components/dynamic/file_share_file.py
Outdated
Show resolved
Hide resolved
Co-authored-by: James Robinson <james.em.robinson@gmail.com>
b41a784
to
ff5028b
Compare
✅ Checklist
Enable foobar integration
rather than515 foobar
).develop
.🚦 Depends on
n/a
Fix how multiline errors are written to a log file
Previous
At c98ce56
At d08520d
🌂 Related issues
n/a
🔬 Tests
Tested locally