当我为Android应用程序编写日志包装器时,我注意到了Android Log.isLoggable方法的奇怪行为。执行下面的代码:Log.isLoggable是否返回错误的值?
final String TAG = "Test";
Log.v(TAG, "verbose is active: " + Log.isLoggable(TAG, Log.VERBOSE));
Log.d(TAG, "debug is active: " + Log.isLoggable(TAG, Log.DEBUG));
Log.i(TAG, "info is active: " + Log.isLoggable(TAG, Log.INFO));
Log.w(TAG, "warn is active: " + Log.isLoggable(TAG, Log.WARN));
Log.e(TAG, "error is active: " + Log.isLoggable(TAG, Log.ERROR));
产生以下的logcat输出:
VERBOSE/Test(598): verbose is active: false
DEBUG/Test(598): debug is active: false
INFO/Test(598): info is active: true
WARN/Test(598): warn is active: true
ERROR/Test(598): error is active: true
为什么我得到详细和调试不活跃,虽然我产生使用详细和调试日志记录这些输出?
断开的链接,请更新。 –