GB_LOGFILES_DIR_IS_UNDEFINED #2394

Closed
opened 1 month ago by vanous · 0 comments
vanous commented 1 month ago
Owner

Logger marks the GB_LOGFILES_DIR as undefined via appending the IS_UNDEFINED.

2021-09-18 22:58:51.825 9143-9143/nodomain.freeyourgadget.gadgetbridge I/System.out: 22:58:51,825 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern GB_LOGFILES_DIR_IS_UNDEFINED/gadgetbridge-%d{yyyy-MM-dd}.%i.log for the active file

2021-09-18 22:58:51.828 9143-9143/nodomain.freeyourgadget.gadgetbridge I/System.out: 22:58:51,827 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@e9d7892 - The date pattern is 'yyyy-MM-dd' from file name pattern 'GB_LOGFILES_DIR_IS_UNDEFINED/gadgetbridge-%d{yyyy-MM-dd}.%i.log.zip'.

2021-09-18 22:58:51.841 9143-9143/nodomain.freeyourgadget.gadgetbridge I/System.out: 22:58:51,841 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file name: GB_LOGFILES_DIR_IS_UNDEFINED/gadgetbridge.log

2021-09-18 22:58:51.891 9143-9143/nodomain.freeyourgadget.gadgetbridge I/System.out: 22:58:51,891 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is set to [/data/data/nodomain.freeyourgadget.gadgetbridge/files/GB_LOGFILES_DIR_IS_UNDEFINED/gadgetbridge.log]

The createLogDirectory in GBApplication seems ok, so does FileUtils.getExternalFilesDir(). The System.setProperty(PROP_LOGFILES_DIR, dir); also works. This is then used by assets/logback.xml. This post is suggesting that the logger should not be static (another post by the same author). Some other suggestions i have found were to try the stop/start multiple times, but i have not tried yet. Probable this here:

    private void startFileLogger() {
        if (fileLogger != null && !fileLogger.isStarted()) {
            addFileLogger(fileLogger);
            fileLogger.setLazy(false); // hack to make sure that start() actually opens the file
            fileLogger.start();
        }
    }
Logger marks the GB_LOGFILES_DIR as undefined via appending the IS_UNDEFINED. ``` 2021-09-18 22:58:51.825 9143-9143/nodomain.freeyourgadget.gadgetbridge I/System.out: 22:58:51,825 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern GB_LOGFILES_DIR_IS_UNDEFINED/gadgetbridge-%d{yyyy-MM-dd}.%i.log for the active file 2021-09-18 22:58:51.828 9143-9143/nodomain.freeyourgadget.gadgetbridge I/System.out: 22:58:51,827 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@e9d7892 - The date pattern is 'yyyy-MM-dd' from file name pattern 'GB_LOGFILES_DIR_IS_UNDEFINED/gadgetbridge-%d{yyyy-MM-dd}.%i.log.zip'. 2021-09-18 22:58:51.841 9143-9143/nodomain.freeyourgadget.gadgetbridge I/System.out: 22:58:51,841 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file name: GB_LOGFILES_DIR_IS_UNDEFINED/gadgetbridge.log 2021-09-18 22:58:51.891 9143-9143/nodomain.freeyourgadget.gadgetbridge I/System.out: 22:58:51,891 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is set to [/data/data/nodomain.freeyourgadget.gadgetbridge/files/GB_LOGFILES_DIR_IS_UNDEFINED/gadgetbridge.log] ``` The `createLogDirectory` in `GBApplication` seems ok, so does `FileUtils.getExternalFilesDir()`. The `System.setProperty(PROP_LOGFILES_DIR, dir);` also works. This is then used by `assets/logback.xml`. [This post](https://mkyong.com/logging/logback-set-log-file-name-programmatically/) is suggesting that the `logger` should not be static ([another post](https://mkyong.com/logging/logback-xml-example/) by the same author). Some other suggestions i have found were to try the stop/start multiple times, but i have not tried yet. Probable this here: ```java private void startFileLogger() { if (fileLogger != null && !fileLogger.isStarted()) { addFileLogger(fileLogger); fileLogger.setLazy(false); // hack to make sure that start() actually opens the file fileLogger.start(); } } ```
vanous closed this issue 1 month ago
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.