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

Can't Create Logger: DateTokenConverter not found? #344

Open
3 tasks done
davidvedvick opened this issue Apr 22, 2023 · 2 comments
Open
3 tasks done

Can't Create Logger: DateTokenConverter not found? #344

davidvedvick opened this issue Apr 22, 2023 · 2 comments
Assignees

Comments

@davidvedvick
Copy link

Describe the bug

After upgrading the Android Gradle Plugin to 8.0, my application crashes. Logs indicate that this is because I have an invalid date token, but the date token appears correct.

java.lang.RuntimeException: Unable to create application com.lasthopesoftware.bluewater.MainApplication: java.lang.IllegalStateException: FileNamePattern [/storage/emulated/0/Android/data/com.lasthopesoftware.bluewater/files/logs/%d{yyyy-MM-dd}.log] does not contain a valid DateToken

Issue starts occurring in this commit:

namehillsoftware/projectBlue@76e9c64

and is worked around by this commit:

namehillsoftware/projectBlue@6d4def3

Updating the proguard file to avoid DateTokenConverter (and other converters perhaps) seemed to fix it:

-keepclassmembers class ch.qos.logback.core.rolling.helper.* { <init>(); }

Reproduction

namehillsoftware/projectBlue@76e9c64

Logs

No response

logback-android version

3.0.0, 2.0.0

OS Version

Android 13

What logback configuration are you using? (logback.xml or Java/Kotlin code)

Kotlin code

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@noproxy
Copy link

noproxy commented May 25, 2023

It affects all logback-android versions.

AGP enables R8 full mode by default since 8.0.0.

And the R8 full mode has some behaviors difference, and the relevant change is:

The default constructor (<init>()) is not implicitly kept when a class is kept.

@noproxy
Copy link

noproxy commented May 25, 2023

It can be resolved by embedding a consumer-proguard-rules to logback-android.

defaultConfig {
      .....
      consumerProguardFiles ‘consumer-rules.pro’
}

The ‘consumer-rules.pro’ content is just as the workaround mentioned by @davidvedvick

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

No branches or pull requests

3 participants