I've got some strange behaviour from logback, the issue is that log.debug() call stop working and not write to console.
Here is how I create Logger and call log functions:
 public class MyApp extends Application {
    private static Logger log = LoggerFactory.getLogger(MyApp.class);
      @Override
      public void onCreate() {
        log.info("log.isDebugEnabled() {}", log.isDebugEnabled());
        log.error("error test");
        log.debug("HELLO {}", "WORLD");
        log.debug("debug test");
        ..............
        /*some code here*/
        ..............
        super.onCreate();
      }
    ..............
    }
And here is what I see in Android Monitor:

As you can see there is NO debug lines, only error and info.
Here is my logback.xml:
    <?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <property name="EXT_FILES_DIR" value="/mnt/sdcard/Android/data/my_dir/files/logs" />
    <timestamp key="bySecond" datePattern="dd.MM.yy'__'HH.mm.ss"/>
    <appender name="logcat" class="ch.qos.logback.classic.android.LogcatAppender">
        <encoder>
            <pattern>%d{HH:mm:ss} :: %-5level :: THREAD [%thread] IN CLASS %logger{5} ON LINE %line - %msg%n</pattern>
        </encoder>
    </appender>
    <appender name="FILE"
              class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${EXT_FILES_DIR}/my_log-${bySecond}.log</file>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <Pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} :: %-5level :: THREAD [%thread] IN CLASS %logger{5} ON LINE %line - %msg%n</Pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
            <FileNamePattern>${EXT_FILES_DIR}/my_log-${bySecond}.%i.log.txt</FileNamePattern>
            <MinIndex>1</MinIndex>
            <MaxIndex>10</MaxIndex>
        </rollingPolicy>
        <triggeringPolicy
            class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <MaxFileSize>2MB</MaxFileSize>
        </triggeringPolicy>
    </appender>
    <root level="DEBUG">
        <appender-ref ref="logcat" />
        <appender-ref ref="FILE"/>
    </root>
</configuration>
Any suggestion? Regards.
The problem was in my Device Hyawei Honor 4x - the manufacturer disabled logs on debug level. Solution is:
Dial
*#*#2846579#*#*
Click on ProjectMenu
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With