글

라벨이 Android logging인 게시물 표시

[Android] Android 로깅 시 isLoggable() 메서드 사용

아래와 같이 isLoggable 이라는 메서드를 사용하여 원하는 로그를 찍고 싶을 경우 system property 값을 원하는 로그 레벨로 변경해 주거나 local.prop 파일을 생성하여 /data/local.prop 으로 위치시켜야 한다. public static void LOGD(final String tag, String message, Throwable cause) {         if (LOGGING_ENABLED){             if (Log. isLoggable (tag, Log.DEBUG)) {                 Log.d(tag, message, cause);             }         }   } system property 값을 변경해 주는 방법은 다음과 같다. adb shell setprop log.tag.<tag> <log level> myLog 라는 tag 를 debug 레벨에서 찍고 싶다면, console 창에서 아래와 같이 써주면 된다. adb shell setprop lgo.tag. myLog DEBUG * 공식사이트에 나와있는 isLoggable 메서드 관련 설명 public static boolean  isLoggable   ( String  tag, int level) Added in  API level 1 Checks to see whether or not a log for the specified tag is loggable at the specified level. The default level of any tag ...