Skip to content
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

Do not truncate error returned by remote server in logs #6105

Closed
mnalis opened this issue Jan 21, 2025 · 1 comment
Closed

Do not truncate error returned by remote server in logs #6105

mnalis opened this issue Jan 21, 2025 · 1 comment

Comments

@mnalis
Copy link
Member

mnalis commented Jan 21, 2025

Use case
When error is returned by remote server, it would be quite useful to see that error in the logs. However, it seems that often such error is truncated, so important information is lost.

E.g. this is the full error logged in the SCEE (I know, different project, but that logging part seems the same as in SC) few weeks ago when I had trouble uploading data (see Helium314#712 for details):

2025-01-01T23:24:23.265: E [Upload] Unable to upload de.westnordost.streetcomplete.data.ConnectionException: Unexpected JSON token at offset 0: Expected start of the object '{', but had '<' instead at path: $
JSON input: <br />
<b>Warning</b>:  Undefi.....

As one can see, the log got auto-truncated at most interested place. There was no rest of the error message in the next line...

Proposed Solution
When we receive error from remote server, if it is too long to fit into single log line, split it automatically in multiple lines so whole error can be seen when log is looked up / shared.

@westnordost
Copy link
Member

StreetComplete doesn't truncate the error message.

Neither the MapDataApiClient that throws the exception, nor the Uploader that puts this into a Log.e message, nor is the string truncated when it is put into the logs database table, nor is it truncated for the view when displayed in the logs view. (Don't know about the logcat of Android, but there's nothing I could change about that anyway)

So, either kotlinx-serialization-json (which is apparently throwing this exception) is truncating the message, or SCEE is, or the android logger is. Either way, wrong repo.

@westnordost westnordost closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants