Skip to content

[FEATURE REQUEST] Logging changes#4204

Merged
Aitorbp merged 14 commits into
masterfrom
feature/loggin_changes
Nov 29, 2023
Merged

[FEATURE REQUEST] Logging changes#4204
Aitorbp merged 14 commits into
masterfrom
feature/loggin_changes

Conversation

@manuelplazaspalacio

@manuelplazaspalacio manuelplazaspalacio commented Oct 31, 2023

Copy link
Copy Markdown
Contributor

Related Issues

App: #4151

  • Added changelog files for the fixed issues in folder changelog/unreleased. More info here

QA

@manuelplazaspalacio manuelplazaspalacio changed the title [FEATURE REQUEST]loggin changes [FEATURE REQUEST] Loggin changes Oct 31, 2023
@JuancaG05 JuancaG05 changed the title [FEATURE REQUEST] Loggin changes [FEATURE REQUEST] Logging changes Oct 31, 2023
@manuelplazaspalacio manuelplazaspalacio marked this pull request as ready for review October 31, 2023 07:52
@manuelplazaspalacio manuelplazaspalacio linked an issue Oct 31, 2023 that may be closed by this pull request
12 tasks
@manuelplazaspalacio manuelplazaspalacio force-pushed the feature/loggin_changes branch 2 times, most recently from cabcda4 to b21e1a5 Compare November 3, 2023 10:34
@manuelplazaspalacio

Copy link
Copy Markdown
Contributor Author

com.github.AppDevNext.Logcat:LogcatCoreLib library deleted due to compatibility issues with the app tests.

@JuancaG05 JuancaG05 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some questions and changes requested here @manuelplazaspalacio! 🚀

Comment thread changelog/unreleased/4204
Comment thread owncloudApp/build.gradle Outdated
Comment thread owncloudApp/src/main/java/com/owncloud/android/providers/LogsProvider.kt Outdated
Comment thread owncloudComLibrary/build.gradle Outdated
Comment thread owncloudData/build.gradle Outdated
@manuelplazaspalacio manuelplazaspalacio force-pushed the feature/loggin_changes branch 2 times, most recently from b535cde to 963c1dd Compare November 6, 2023 12:52

@JuancaG05 JuancaG05 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved from my side! Good job 👍

@jesmrec

jesmrec commented Nov 7, 2023

Copy link
Copy Markdown
Contributor

QA checks

Will compare request/responses caught with mitmproxy with the same ones in the logs. They must be identical:

  • GET /status.php (oC10)
  • GET /apps/files/ (oCIS)
  • PROPFIND /dav/spaces/ (OCIS)
  • PROPFIND /remote.php/dav/files (oC10)
  • GET /ocs/v2.php/cloud/capabilities (oC10) (includes response)
  • GET /graph/v1.0/me/drives (oCIS)
  • MKCOL /remote.php/dav/files// (oC10) - things to fix
  • MKCOL /dav/spaces/<space_id>/ (oCIS, oC10)
  • PUT (oC10, oCIS)
  • COPY (oC10, oCIS)
  • DELETE (oC10, oCIS)
  • POST (oC10, oCIS)

@JuancaG05 JuancaG05 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved after the latest changes 👍

@jesmrec

jesmrec commented Nov 16, 2023

Copy link
Copy Markdown
Contributor

Let's QA this one

@jesmrec

jesmrec commented Nov 16, 2023

Copy link
Copy Markdown
Contributor

(1)

Name of the file is not re-generated?

  1. Enable Logging
  2. Generate some logs by browsing etc... -> log file generated with name (f.ex): owncloud.2023-11-17_08.35.34.log
  3. Remove that file by clicking on the trashbin icon
  4. Generate more logs after some minutes

Current: log file name is the same: owncloud.2023-11-17_08.35.34.log
Expected: new log file with different timestamp

Pixel 2 Android11
94c9fbafc

@jesmrec

jesmrec commented Nov 16, 2023

Copy link
Copy Markdown
Contributor

(2)

I generate a log file including several operations, i will comment some issues about that:

owncloud.2023-11-17_08.56.03.log

  • I noticed that the response body scapes the quotation marks in the HTTP RESPONSE: {"response":{"body":{"data":"{\"ocs\":{\"meta\":{\"status\"... (line 229). Why is that required?

  • There are some lines with Operation finished with HTTP status code -1 (success) (225, 289, 298...).

  • I noticed that some requests like avatar (check line 143) lacks of body response in the JSON when it is empty. However, if response is empty, it's logged {"response":{"body":{"data":"","length":0}... . Should be the same for both requests and responses?

@Aitorbp

Aitorbp commented Nov 24, 2023

Copy link
Copy Markdown
Contributor

In relation to the second QA report, related to the status code -1, it is caused because the mHttpCode variable has no value at this point and sets the default value, which is -1.
When we have this case, where we have a resultCode.OK, there is no condition in the getLogMessage function that handles this case. Therefore, I would put one more condition for results with mCode == ResultCode.Ok, putting a message like: successful response.

@jesmrec

jesmrec commented Nov 27, 2023

Copy link
Copy Markdown
Contributor

putting a message like: successful response.

i don't get this point. Code statuses should not be replaced by strings, we are adding noises to the log. A "successful response" could be 200, 201, 207... is there no way to keep the code status?

@Aitorbp

Aitorbp commented Nov 27, 2023

Copy link
Copy Markdown
Contributor

putting a message like: successful response.

i don't get this point. Code statuses should not be replaced by strings, we are adding noises to the log. A "successful response" could be 200, 201, 207... is there no way to keep the code status?

I have seen that in other parts of the application the log is managed from the Operation. For example, in GetUrlToOpenInWebRemoteOperation the following timber is written: Timber.d("Open in web for file: $fileId - $status${if (!isSuccess(status)) "(FAIL)" else ""}"). Here the status will appear correctly. In any case, the solution shown above, code statuses are replaced by strings in all cases.

@JuancaG05

Copy link
Copy Markdown
Contributor

In any case, the solution shown above, code statuses are replaced by strings in all cases.

It shouldn't be like that. We're losing information in such case.

@jesmrec

jesmrec commented Nov 28, 2023

Copy link
Copy Markdown
Contributor

About (1), not sure if directly related. Follow these steps:

  1. Enable logs and do some operations to create a file (check a log file)
  2. In device settings, move date to the following day to create a new log file correspondent to that date
  3. Open the app and generate logs (at this point, we have 2 different log files)
  4. In logs view, remove the latest file and generate more files

Current: two files (entries) are generated.
Expected: only one generated

Pixel 2 Android11
aa4448660

@Aitorbp

Aitorbp commented Nov 28, 2023

Copy link
Copy Markdown
Contributor
  • I noticed that the response body scapes the quotation marks in the HTTP RESPONSE: {"response":{"body":{"data":"{\"ocs\":{\"meta\":{\"status\"... (line 229). Why is that required?

Regarding the first QA bug, the method that parses the json responseJsonAdapter.toJson is managed by the Moshi library, in this case we cannot do much, the library considers parsing the data in this way.

@Aitorbp

Aitorbp commented Nov 28, 2023

Copy link
Copy Markdown
Contributor

About (1), not sure if directly related. Follow these steps:

  1. Enable logs and do some operations to create a file (check a log file)
  2. In device settings, move date to the following day to create a new log file correspondent to that date
  3. Open the app and generate logs (at this point, we have 2 different log files)
  4. In logs view, remove the latest file and generate more files

Current: two files (entries) are generated. Expected: only one generated

Pixel 2 Android11 aa4448660

We are opened an issue to fix this:

@Aitorbp

Aitorbp commented Nov 28, 2023

Copy link
Copy Markdown
Contributor

I update the general outline of the PR:

  • Fix 1: Related to tho name of the file is not re-generated. (Waiting QA approval)
  • Fix 2:
  • Response body scapes the quotation marks. (answered in previous comment)
  • Lines with Operation finished with HTTP status code -1. (Waiting QA approval)
  • Some requests like avatar (check line 143) lacks of body response in the JSON when it is empty. (Need more info)
  • Two logs are created when no logs in screen and close and open app. (Created new issue)

@jesmrec

jesmrec commented Nov 28, 2023

Copy link
Copy Markdown
Contributor

Summarizing:

I noticed that the response body scapes the quotation marks in the HTTP RESPONSE: {"response":{"body":{"data":"{"ocs":{"meta":{"status"... (line 229). Why is that required?

won't fix

There are some lines with Operation finished with HTTP status code -1 (success) (225, 289, 298...).

fixed

I noticed that some requests like avatar (check line 143) lacks of body response in the JSON when it is empty. However, if response is empty, it's logged {"response":{"body":{"data":"","length":0}... . Should be the same for both requests and responses?

won't fix, let's take this as correct

@jesmrec

jesmrec commented Nov 28, 2023

Copy link
Copy Markdown
Contributor

Will get this as first approach, open to new improvements.

I'd go for a better formatting on the lines. Let's take a look to an iOS log:

ownCloud_28_Nov_2023_at_10_11_37.log.txt

seems to be more structured (beyond the specific json-format of reqa/resps). Wdyt?

@Aitorbp Aitorbp force-pushed the feature/loggin_changes branch from cee75c3 to af67d27 Compare November 28, 2023 17:04
@Aitorbp Aitorbp merged commit fa7a484 into master Nov 29, 2023
@Aitorbp Aitorbp deleted the feature/loggin_changes branch November 29, 2023 11:28
Aitorbp added a commit that referenced this pull request Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Logging changes

4 participants