나의 발자취

Android Studio Logging 디버깅: Logcat 본문

카테고리 없음

Android Studio Logging 디버깅: Logcat

달모드 2023. 6. 14. 22:53

The Log class allows us to create log messages that appear in Logcat. Generally, we should use the following log methods, listed in order from the highest to the lowest priority.

  • Log.e(String, String) // Error -------------------- 이슈를 야기하는 에러 ------------------------no. 1 PRIORITY 
  • Log.w(String, String) // Warning -------------------- 아직은 에러가 아니지만 가능성 있는 것 -----no. 2 PRIORITY 
  • Log.i(String, String) // Information -------------------- 일반적으로 사용 시 나타나는 로그 -------no. 3 PRIORITY 
  • Log.d(String, String) // Debug -------------------- 개발에 유용한 디버깅 정보만 볼때 -----------no. 4 PRIORITY 
  • Log.v(String, String) // Verbose -------------------- 제일 기본값으로 되어있음. ----------------no. 5 PRIORITY 

 

Write log messages

아래와 같이 변수 선언 후 로그를 입력해준다.

이런식으로 추가 후에 로그캣에서 main 입력해서 필요한 로그만 볼 수 있다.

 

로그 메시지 형식은 다음과 같다: date time PID-TID/package priority/tag: message

로그 예시:

2020-01-13 16:57:57.124 21711-21711/com.example.helloworld I/MainActivity: Main Activity

date: 2020-01-13
time: 16:57:57
PID-TID (Process Identifier - Thread Identifier): 21711-21711
package: com.example.helloworld
priority: I
tag: MainActivity
message: Main Activity                                                                                                               출처: codecademy

Comments