Skip to content

Replace util/Log.java with java.util.logging #21

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Flowdalic
Copy link

Logger (from java.util.logging / jul) gives the user more control over which
statements are logged and which not, in a much more generic fashion then a custom Log.java.

It's easily possible to wrap the jul Logger into the Android Logger and have the same functionality. For example, I use the following JULHandler to pass all jul logs into Android's log system: https://bitbucket.org/projectmaxs/maxs/src/master/main/src/org/projectmaxs/shared/global/jul/JULHandler.java?at=master

@dschuermann
Copy link
Member

I currently have time constraints from other projects, so without testing ;) some questions:
As I understand it, there need to be a JULHandler to actually get the previous behavior logging to android's logcat?
If yes, why does your pull request do not contain such a wrapper?
I am not really sold to this pull request currently...

@Flowdalic
Copy link
Author

Because it's not part of the job description of a library to provide such a handler. :-) This is something the library user could install, or just leave it to the Android defaults which will print the jul log messages just like Android Log would do. So no, you don't need the JULHandler to get most of the previous behavior. But without a custom handler, Android will only print jul log levels of INFO and higher.

To be able to get the debug log messages you need to configure JUL accordingly, which is the only feature, enable/disable debug log, the mentioned JULHandler provides (compared to not using it).

But there are many other ways to configure JUL, for example you could configure it to log all INFO and higher logs from the `org.sufficientlysecure' namespace, while also logging FINE or higher logs from the 'com.foo.bar' namespace. This makes JUL very flexible and comes in very handy to track down bugs. You can also use different Formatters and Handlers for a namespace, even multiple if you feel like it.

tl;dr: If you replace all Android Log calls with jul Logger in an Android app, nothing will change, except that FINE or lower level logs are not logged, if you don't enable them automatically. But you will give more control and flexibility to your library users.

@Flowdalic
Copy link
Author

Ping :)

Anything else required from my side? I really like to see more libraries doing logging right™, every library using JUL is one step forward towards a cleaner and more readable Android system log.

@dschuermann
Copy link
Member

Sry, all development for superuser-commands has stopped currently. To make it future proof I would need to recode most of it. So if anyone wants to fork go ahead.

@Flowdalic
Copy link
Author

To make it future proof I would need to recode most of it.

What's the matter with the current implementation?

@dschuermann
Copy link
Member

The underlying inner workings must be reworked based on https://github.com/Chainfire/libsuperuser to account for many current problems which will worsen due to recent Android changes:
https://plus.google.com/+Chainfire/posts/Lyhjzu1z9s1
https://plus.google.com/113517319477420052449/posts/ZtXAhw164QD
https://plus.google.com/113517319477420052449/posts/TkGWeaiCYA9

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

Successfully merging this pull request may close these issues.

3 participants