0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

logback-android を使う時に logback.xml を置く場所

Posted at

メモ。
Androidアプリで logback-android を使う。

gradleの設定。

app/build.gradle
dependencies {
  implementation 'org.slf4j:slf4j-api:2.0.7'
  implementation 'com.github.tony19:logback-android:3.0.0'
}

設定ファイル logback.xml を作成。

logback.xml
<configuration>
    <appender name="logcat" class="ch.qos.logback.classic.android.LogcatAppender">
        <encoder>
            <pattern>%msg</pattern>
        </encoder>
    </appender>

    <root>
        <appender-ref ref="logcat" />
    </root>
</configuration>

logback.xml を設置する場所について、logback-android 公式で app/src/main/assets/logback.xml と書かれているが、これは情報が古く、
いまのAndroidプロジェクトでは app/assets/logback.xml です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?