๋ฐ์ํ
Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- ์น๋์๋ณด๋ ์ ์
- Streamlit๊ธฐ์ด
- Pandas
- ์คํธ๋ฆผ๋ฆฟ
- JavaScript
- ์น๋์๋ณด๋ ๊ธฐ์ด
- ์๋ฐํ๋ก๊ทธ๋๋ฐ
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- MySQL
- RESTful API
- ์๋๋ก์ด๋ ์ฑ ๊ฐ๋ฐ
- ์๋ฐ๊ธฐ์ด
- java
- serverless
- ์๋ฐ๊ณต๋ถ
- ํ์ด์ฌ๊ณต๋ถ
- ์คํธ๋ฆผ๋ฆฟ ๊ธฐ๋ณธ
- Streamlit๊ธฐ๋ณธ
- ์๋ฐ์ด๋ณด
- streamlit
- ์๋ฐ์คํฌ๋ฆฝํธ ๊ณต๋ถ
- ์๋๋ก์ด๋ ์คํ๋์ค
- ํ๋ค์ค
- ํ์ด์ฌ
- db
- ํ๋ค์ค๊ณต๋ถ
- ์๋ฐ
- Android
- Flutter
- ์๋ฐ์คํฌ๋ฆฝํธ
Archives
- Today
- Total
ruriruriya
[Android] ์๋๋ก์ด๋ - ๋ก๊ทธ ์ฒ๋ฆฌํ๋ ๋ฐฉ๋ฒ(Log ํด๋์ค) ๋ณธ๋ฌธ
๐คAndroid/Java
[Android] ์๋๋ก์ด๋ - ๋ก๊ทธ ์ฒ๋ฆฌํ๋ ๋ฐฉ๋ฒ(Log ํด๋์ค)
๋ฃจ๋ฆฌ์ผใ 2023. 12. 21. 13:58๋ฐ์ํ
์๋๋ก์ด๋ ์คํ๋์ค์์ ๋ก๊ทธ ์ฒ๋ฆฌํ๋ ๋ฐฉ๋ฒ์ ์์๋ณด์.
1. Log ํด๋์ค import
๋จผ์ Log ํด๋์ค๋ฅผ import ํ๋ค.
import android.util.Log;
2. Info ๋ก๊ทธ ์ถ๋ ฅ
ํ์๊ฐ์
์ผ๋ก ์
๋ ฅ๋ ์ ๋ณด๋ฅผ ๋ณ์์ ์ ์ฅํด์
์ ๋ณด ๋ก๊ทธ๋ฅผ Logcat์์ ์ถ๋ ฅํด๋ณธ๋ค.
btnSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 1.์ด๋ฆ ๊ฐ์ ธ์ค๊ธฐ
String name = editName.getText().toString().trim();
// ์๋๋ก์ด๋์์ ๋ก๊ทธ ๋จ๊ธฐ๋ ๋ฐฉ๋ฒ
Log.i("UITEST MAIN","์ ์ ๊ฐ ์์ฑํ ์ด๋ฆ : "+ name);
// 2. ์ด๋ฉ์ผ ์ฃผ์ ๊ฐ์ ธ์ค๊ธฐ
String email = editEmail.getText().toString().trim();
// ์๋๋ก์ด๋์์ ๋ก๊ทธ ๋จ๊ธฐ๋ ๋ฐฉ๋ฒ
Log.i("UITEST MAIN","์ ์ ๊ฐ ์์ฑํ ์ด๋ฉ์ผ : "+ email);
// 3. ๋น๋ฐ๋ฒํธ ๊ฐ์ ธ์ค๊ธฐ
String password = editPassword.getText().toString().trim();
// ์๋๋ก์ด๋์์ ๋ก๊ทธ ๋จ๊ธฐ๋ ๋ฐฉ๋ฒ
Log.i("UITEST MAIN","์ ์ ๊ฐ ์์ฑํ ๋น๋ฐ๋ฒํธ: "+ password);
}
});
[Device Emulator]
[Logcat]
3. ๋ค๋ฅธ ์ฉ๋ Log Level
Log ํด๋์ค์ ๋ฉ์๋๋ฅผ ์ฌ์ฉํด์ ๋ก๊ทธ ๋ ๋ฒจ์ ์ง์ ํ ์ ์๋ค.
import android.util.Log;
// ...
// ๋ก๊ทธ ์ถ๋ ฅ
Log.d("TAG", "Debug ๋ก๊ทธ ๋ฉ์์ง");
Log.e("TAG", "Error ๋ก๊ทธ ๋ฉ์์ง");
Log.i("TAG", "Info ๋ก๊ทธ ๋ฉ์์ง");
Log.w("TAG", "Warning ๋ก๊ทธ ๋ฉ์์ง");
Log.v("TAG", "Verbose ๋ก๊ทธ ๋ฉ์์ง");
๋ฐ์ํ