Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when setting up File Logger Tree #26

Open
geldf opened this issue Sep 4, 2023 · 2 comments
Open

Crash when setting up File Logger Tree #26

geldf opened this issue Sep 4, 2023 · 2 comments

Comments

@geldf
Copy link

geldf commented Sep 4, 2023

Hello, this library has been successfully integrated into our app.

However, according to Firebase Crashlytics, a few users encountered the issue below. We are unable to duplicate the same problem though. Here is the stack trace:

Caused by java.io.IOException: Couldn't get lock for /data/user/0/app_name/files/error_log/01_09_2023%g.txt at java.util.logging.FileHandler.openFiles(FileHandler.java:439) at java.util.logging.FileHandler.<init>(FileHandler.java:403) at .. at .. at .. at .. at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1190) at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7184) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7134) at android.app.ActivityThread.access$1600(ActivityThread.java:274) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2102) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:8167) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

Devices are Oppo, Samsung, Vivo
image

Any help would be appreciated. Thank you!

@Wolf00Bomber
Copy link

Same issue seen on my Pixel 4:

15:55:09.939 W java.nio.file.NoSuchFileException: Download/Options.log.0.lck
15:55:09.939 W at sun.nio.fs.UnixFileSystemProvider.newFileChannel(UnixFileSystemProvider.java:183)
15:55:09.940 W at java.nio.channels.FileChannel.open(FileChannel.java:292)
15:55:09.940 W at java.nio.channels.FileChannel.open(FileChannel.java:345)
15:55:09.940 W at java.util.logging.FileHandler.openFiles(FileHandler.java:460)
15:55:09.940 W at java.util.logging.FileHandler.(FileHandler.java:403)
15:55:09.940 W at fr.bipi.treessence.file.FileLoggerTree$Builder.build(FileLoggerTree.kt:249)
...
15:55:09.940 W at android.os.MessageQueue.nativePollOnce(Native Method)
15:55:09.940 W at android.os.MessageQueue.next(MessageQueue.java:335)
15:55:09.941 W at android.os.Looper.loopOnce(Looper.java:161)
15:55:09.941 W at android.os.Looper.loop(Looper.java:288)
15:55:09.941 W at android.os.HandlerThread.run(HandlerThread.java:67)

There is no sample usage of how we need to pass the directory path. Giving rise to confusion.

@Wolf00Bomber
Copy link

@geldf Seems I was able to bypass this exception when I created a log file in External Downloads Folder:
(Note: I have not tried the data folder yet!)

val t: Timber.Tree = FileLoggerTree.Builder()
            .withFileName("${DateUtils.getSimpleDate()}.log")
            .withDirName(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).absolutePath)
            .withSizeLimit(10 * SIZE_LIMIT) // ~ 10 MB
            .withFileLimit(1)
            .withMinPriority(Log.VERBOSE)
            .appendToFile(true)
            .build()
Timber.plant(t)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants