Piotr Krzemiński
12/02/2022, 2:21 PMChanging log factory from com.pinterest.ktlint.core.internal.LoggerFactory to com.pinterest.ktlint.core.internal.LoggerFactory
java.lang.Throwable
at org.jetbrains.kotlin.com.intellij.openapi.diagnostic.Logger.logFactoryChanged(Logger.java:76)
...40 other lines
which is mildly annoying 🙂
related issues:
• https://github.com/jeremymailen/kotlinter-gradle/issues/254
• https://github.com/jeremymailen/kotlinter-gradle/issues/110
• https://github.com/pinterest/ktlint/issues/1497
All issues point to some kind of non-determinism, and I didn’t manage to pin down when it exactly happens and when it doesn’t.
The stack trace goes through this place in ktlint and this place in intellij-community which actually prints the stack trace: ExceptionUtil.getThrowableText(new Throwable())
. It’s generally unusual to print such stack trace unless some debug API is called.
How about we try to remove this track trace, i.e. contribute to intellij-community? Then this log will produce a single line which won’t be painful. Alternatively, we can try to use a proper logger and print the stack trace if DEBUG level is enabled, but it might be a chicken-egg problem since we’re changing logger factories, so which logger should we use?
WDYT?