Logback Android: what is tagencoder?

I'm using logback Android( https://github.com/tony19/logback-android ), and try to set up some logback modes. So I mean the quick start in the logback Android page

But I don't know what < tagencoder > means

what is it? What is the difference between and < encoder >?

<configuration>
  <appender name="logcat" class="ch.qos.logback.classic.android.LogcatAppender">
    <tagEncoder>
      <pattern>%logger{12}</pattern>
    </tagEncoder>
    <encoder>
      <pattern>[%-20thread] %msg</pattern>
    </encoder>
  </appender>

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

resolvent:

As we all know, logs in Android have tag and message structures https://developer.android.com/reference/android/util/Log.html

So the tagencoder will generate a tag, and the encoder will generate a message in your log

You can use an encoder without a tag, but it's best to also use a tag to easily sort and search in logcat

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>