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

Better logging gui #2725

Merged
merged 10 commits into from
Nov 27, 2019
Merged

Better logging gui #2725

merged 10 commits into from
Nov 27, 2019

Conversation

hannesa2
Copy link
Contributor

@hannesa2 hannesa2 commented Nov 15, 2019

It's the #2694 but on ownCloud repo, instead of my fork

Implements #2730
Needs owncloud/android-library#283

QA

Test plan: https://github.com/owncloud/QA/blob/master/Mobile/Android/Release_2.14.0/2725%20-%20Timber.md

@abelgardep
Copy link
Contributor

abelgardep commented Nov 18, 2019

I have found some problems @hannesa2 .

1- I got an infinity loop clearing logfile
infinity-loop

2- stopLogging is not used anywhere

3- Some of these problems are still reproducible (It would be interesting to solve them)
#2694 (comment)

@hannesa2
Copy link
Contributor Author

  1. I got an infinity loop clearing logfile -> fixed
  2. stopLogging is not used anywhere -> I kept it, because when someone has the idea to re-intoduce stopLogging. If I immediate delete it, I expect the call for it
  3. I write there

Copy link
Contributor

@abelgardep abelgardep left a comment

Choose a reason for hiding this comment

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

Ok, thanks @hannesa2 . Moving this forward

@abelgardep
Copy link
Contributor

Ready to QA @jesmrec

@jesmrec jesmrec self-requested a review November 20, 2019 11:51
@jesmrec
Copy link
Collaborator

jesmrec commented Nov 20, 2019

@hannesa2 it is very appreciated. Also, it'd be appreciated if the library PR: owncloud/android-library#275 is moved to the oC repo as well.

@jesmrec
Copy link
Collaborator

jesmrec commented Nov 20, 2019

(1) [NR]

The log searching is case-sensitive. This is a bit tricky, since the main target is getting matches, regardless if capitals are there or not. Is it feasible to set the searching as non case sensitive or is it a Timber feature?

@jesmrec
Copy link
Collaborator

jesmrec commented Nov 20, 2019

(2) [FIXED]

  1. Open the Logs view
  2. Share the logs with ownCloud

Current: nothing happens
Expected: folder picker?

This took my attention, since other apps in the same device displays the folder picker to share with ownCloud, but the Log app. But, not sure it this is a matter of the library itself. Sharing with other available providers works properly.

companion object {
private const val logCatTargetFileName = "logfile.log"
private const val logCatSearchHint = "search logcat"
private const val bothLogsTargetFileName = "Owncloud.log"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, don't use Owncloud as hardcoded string inside the code, due to branding reasons. You can use the app_name or other parameter.

Copy link
Contributor Author

@hannesa2 hannesa2 Nov 20, 2019

Choose a reason for hiding this comment

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

ok, let's call it log.log (or something other less-meaningful) before it was
image
even current and older hasn't that much meaningful name
image

app_name needs context , so companion object is not the best place anymore then

But the branch is in your repo, you can do what you want

@jesmrec
Copy link
Collaborator

jesmrec commented Nov 20, 2019

(4) [FIXED]

About log rotation, every day is created a new file. Long term will flood the app folder with logs. Any way/chance to clean logs (automatically or manually)?

Logs are stored in the root folder of the app in the internal storage. Shouldn't be stored in a specific folder called Logs? (feasible?)

additional ideas welcome

@hannesa2
Copy link
Contributor Author

(2)

  1. Open the Logs view
  2. Share the logs with ownCloud

Current: nothing happens
Expected: folder picker?

This took my attention, since other apps in the same device displays the folder picker to share with ownCloud, but the Log app. But, not sure it this is a matter of the library itself. Sharing with other available providers works properly.

No need for a file picker anymore. It has just one recent file

@hannesa2
Copy link
Contributor Author

(4)

About log rotation, every day is created a new file. Long term will flood the app folder with logs. Any way/chance to clean logs (automatically or manually)?

Logs are stored in the root folder of the app in the internal storage. Shouldn't be stored in a specific folder called Logs? (feasible?)

additional ideas welcome

This file logging is pointless since you see in release log. And additional you can share logcat with others.
Why is a file needed ?

But about flooting: Maybe we should delete all *.log files in that directory during clear log ?

@hannesa2
Copy link
Contributor Author

(1)

The log searching is case-sensitive. This is a bit tricky, since the main target is getting matches, regardless if capitals are there or not. Is it feasible to set the searching as non case sensitive or is it a Timber feature?

It's the behaviour like before. Make an issue and I apply it later.
Please don't expand requirements, otherwise it will be an endless story

@jesmrec
Copy link
Collaborator

jesmrec commented Nov 20, 2019

(1) -> in the previous log implementation, searching was not case sensitive. For example:

device-2019-11-20-154618

(2)

No need for a file picker anymore. It has just one recent file

if you open the Log view and you want to sync it in your oC server by sharing, you can't (in the former implementation you could). The option is there and does nothing. IMHO is confusing if you select ownCloud in the picker and nothing happens. Every action should have a reaction. It is not a matter of watching the file, but storing the file.

(3) -> will check the new names. pending.

(4)

Maybe we should delete all *.log files in that directory during clear log ?

that works for me. What do you think @abelgardep @davigonz

@jesmrec
Copy link
Collaborator

jesmrec commented Nov 20, 2019

@hannesa2 in the report (1) you are right, ignore my answer, since the word chunk appears twice in the line, one in uppercase and other in lowercase. former filter worked in case sensitive as well.

So, the behaviour is the same and we are not losing functionality. We can go on with it.

@hannesa2
Copy link
Contributor Author

hannesa2 commented Nov 21, 2019

(2)

A: during investigation, I solved a lot of lint issues, but my experience with #2680 told me not to push this, because it causes too much afford. You prefer to go with a bad current state, instead of an improvement which not fit 100% concerning automatic code format

B: file chooser
By the way this use case ! Ok, it should work.
I guess @davigonz knows, what the sense of this prevention is. (It blocks share from oC to oC)
I removed it, and it works. But please change this by your own. I see no sense in it
image

@hannesa2
Copy link
Contributor Author

(4)

Maybe we should delete all *.log files in that directory during clear log ?

that works for me. What do you think @abelgardep @davigonz

When you want to go this way, I'm ready prepared

@abelgardep
Copy link
Contributor

(4)

Maybe we should delete all *.log files in that directory during clear log ?

that works for me. What do you think @abelgardep @davigonz

When you want to go this way, I'm ready prepared

Go ahead 👍

@davigonz
Copy link
Contributor

A: during investigation, I solved a lot of lint issues, but my experience with #2680 told me not to push this, because it causes too much afford. You prefer to go with a bad current state, instead of an improvement which not fit 100% concerning automatic code format

About #2680 , as @abelgardep pointed in #2680 (comment) , there's some automatic transformations from Java to Kotlin that are a bit dangerous, mostly related to nullability.

causes too much afford

Do you mean effort? Code reviews cause effort, it's something usual in a development process, you might probably know that. We do not merge code as it is, if some changes are needed, they should be applied. Otherwise, we will pile up not 100% proper code and it will end up in something not that good.

I guess @davigonz knows, what the sense of this prevention is. (It blocks share from oC to oC)
I removed it, and it works. But please change this by your own. I see no sense in it

Yes, I can not give the details about that change but it was needed. I will have a look at it anyway.

By the way, I've noticed that there's a duplicated share icon when I install it in a Nexus 6P, any idea?

@hannesa2
Copy link
Contributor Author

(4)

Go ahead 👍

@abelgardep done

@hannesa2
Copy link
Contributor Author

By the way, I've noticed that there's a duplicated share icon when I install it in a Nexus 6P, any idea?

Sorry, I've no such device.

I add this share for each fragment separately with

override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {

    inflater?.inflate(R.menu.menu_log, menu)

My expectation is that it's only added for recent fragment

@hannesa2
Copy link
Contributor Author

Before:
image

git push upstream

Now:
image

This has nothing to do with upper/lowercase branch names. You can call it, what you want, simply sha1 rules
image

@davigonz
Copy link
Contributor

davigonz commented Nov 26, 2019

@hannesa2

Yesterday I performed the next steps in your library repo:

  1. git checkout BetterLogging
  2. git fetch
  3. git rebase

And the result was what you see in the image below

Screenshot 2019-11-25 at 14 04 41

The remote tracking reference is origin/BetterLogging and it was containing the commits of your remote betterLogging branch (increase cache size, split log into debug and release) instead of the commits of your remote BetterLogging branch. No idea about what was going on under the hood, but is the first time I see something like this. Maybe I'm missing something.

@davigonz
Copy link
Contributor

davigonz commented Nov 26, 2019

(5) [FIXED]

Share icon appears as the clear log option when the clear log option has enough room to appear in the top bar.

Nov-26-2019 10-28-17

The fix is included via AppDevNext/Logcat#29 , could you check it @hannesa2 ? Thanks

@davigonz
Copy link
Contributor

@jesmrec all the bugs should already be fixed, could you check them?

@jesmrec
Copy link
Collaborator

jesmrec commented Nov 27, 2019

(6) (improvement)

After fixing (2) and (3), the name of the logs file to share is always

<app name>.log

would it be posible to add the timestamp (same as the log stored in device). So, if some files are stored, can be distinguised. Something like

_20191127_101145.log

what do you think?

@@ -51,7 +50,7 @@ class LogHistoryActivity : ToolbarActivity() {

fileLoggingTree()?.let {
logFragment = BothLogsFragment.newInstance(
bothLogsTargetFileName,
"${getString(R.string.app_name)}.log",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't debugged it, but is it that smart to use R.string.app_name ? What's about when the app has a name like "my Cloud" with space ?
Leave it like it was and all is fine

Copy link
Contributor

@davigonz davigonz Nov 27, 2019

Choose a reason for hiding this comment

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

I tried it and no problem at all with spaces in the log to share

@hannesa2
Copy link
Contributor Author

hannesa2 commented Nov 27, 2019

(6) (improvement)

would it be posible to add the timestamp (same as the log stored in device). So, if some files are stored, can be distinguised. Something like

_20191127_101145.log

what do you think?

https://github.com/hannesa2/Logcat/blob/5cba849239a0d71ef21f69d91c986c875c16b580/LogcatLib/src/main/java/info/hannes/timber/FileLoggingTree.kt#L23-L28
I don't recommend it, then the name will be _20191127_101145.2019-11-27.log ...please not

Maybe this on https://github.com/owncloud/android-library/pull/283/files#r351259590 ? But it's up to you. For me it was fine, everything now makes it not better

@jesmrec
Copy link
Collaborator

jesmrec commented Nov 27, 2019

sorry, GH text processor played me a trick.

What i meant, is using the name of the app as name of the file (what i called there as "<nameApp>.log" and GH ellipsized):

ownCloud.log
MyApp.log
MyCompany.log

depending on the parameter in setup.xml for the appName.

so, the improvement will change those names for

ownCloud_20191127_101145.log
MyApp_20191127_101145.log
MyCompany_20191127_101145.log

sorry for not reviewing the published comment

@davigonz
Copy link
Contributor

davigonz commented Nov 27, 2019

ownCloud_20191127_101145.log
MyApp_20191127_101145.log
MyCompany_20191127_101145.log

@jesmrec This is not that trivial so I would keep it as it is, just appname.log . The dates and time appear inside the log files.

@jesmrec
Copy link
Collaborator

jesmrec commented Nov 27, 2019

Ok, let's keep it ftm... awaiting for more feedback.

From my side this is approved.

Thanks for the contribution @hannesa2!

@jesmrec jesmrec self-requested a review November 27, 2019 15:06
@davigonz davigonz merged commit fe4c3c0 into master Nov 27, 2019
@delete-merged-branch delete-merged-branch bot deleted the BetterLoggingGUI branch November 27, 2019 17:54
@davigonz davigonz mentioned this pull request Dec 2, 2019
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.

4 participants