-
Notifications
You must be signed in to change notification settings - Fork 103
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
base: master
Are you sure you want to change the base?
Conversation
when synchronizing on 'this'.
I currently have time constraints from other projects, so without testing ;) some questions: |
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. |
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. |
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. |
What's the matter with the current implementation? |
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: |
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