Android: java.util.logging.Logger vs android.util.Log
Why Android
does it support 2 different log classes that seem to support the same things?
I'm talking about:
-
Log
android.util.Log -
Logger
java.util.logging.Logger
For what I've seen over the years, every official Android documentation points to Log
, not Logger.
Even certain loggers like TimingLogger use Log
.
So why are these 2 supported?
Is there any function that can be used through Logger
that I cannot achieve through Log
?
Are there specific use cases for both?
+3
source to share
1 answer
The crossover function looks like this:
- android.util.Log = java.util.logging.Logger
- android.util.Printer = java.util.logging.Formatter
- android.util.PrintStreamPrinter = java.util.logging.StreamHandler
It seems that "android.util.Log" will have:
- Support for Android magazine .
- Support for streams, writers and strings.
- It will be smaller, easier, and probably faster.
It looks like "JUL" will have:
- Buffering records with java.util.logging.MemoryHandler . It is useful to tell when an error occurs
SEVERE
, you can include the last 1000 records, which may be at a lower level. - Filtering records using java.util.logging.Filter . Filters without box are included in the package, but it gives more details on how to implement this behavior in android.util.Printer
- XML socket support .
- Socket support Sockets .
- Third party support java.util.logging.Handler implementation .
+1
source to share