Help us understand the problem. What is going on with this article?

Androidでjava.util.loggingのINFOより低レベルのログを出力する方法

More than 3 years have passed since last update.

なんで標準のandroid.util.Logを使わないの?

普通はandroid.util.Logを使えばいいかと思います。
Android用じゃないライブラリを使ったときに、内部で埋め込まれてるDEBUGレベルのログが出力されなくて困ったときの対応でした。

なんで出力されないのか

以下のStackoverflowの回答の通り。

http://stackoverflow.com/questions/4561345/how-to-configure-java-util-logging-on-android

What is broken is the default logging handler shipped with Android, it ignores any log messages with level finer than INFO. You don't see DEBUG etc. messages.

The reason is the call to Log.isLoggable() in AndroidHandler.java:
https://github.com/android/platform_frameworks_base/blob/master/core/java/com/android/internal/logging/AndroidHandler.java

対応方法

上記の回答とともに紹介されているように、独自のHandlerを用意してログレベルを強制的に変更することで出力されるようになりました。

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    AndroidLoggingHandler.reset(new AndroidLoggingHandler());
    java.util.logging.Logger.getLogger("my.category").setLevel(Level.FINEST);
...

デバッグ目的ならこれでいいかなと。地味に助かる!

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away