So I log to my `KSPLogger` but the text doesn't sh...
# ksp
s
So I log to my
KSPLogger
but the text doesn't show up in my
./gradlew build
output. How do I change that? Or alternatively, where does the output show up?
j
can you check your gradle Logging level? For example,, if you use KSPLogger to log in
INFO
level then you should also set gradle log level to
INFO
by add
--info
to your gradle argument.
s
the logged text simply doesn't show up
Copy code
override fun process(resolver: Resolver): List<KSAnnotated> {
...
        <http://logger.info|logger.info>("options: $options")
        throw Throwable("options: $options")
    }
with
./gradlew clean build --info
leading to
Copy code
> Task :workload:kspKotlin FAILED
file or directory '/Users/sschroeder/IdeaProjects/ksp-service-logger-embedded/workload/src/main/kotlin', not found
Caching disabled for task ':workload:kspKotlin' because:
  Build cache is disabled
Task ':workload:kspKotlin' is not up-to-date because:
  Output property 'destinationDirectory' file /Users/sschroeder/IdeaProjects/ksp-service-logger-embedded/workload/build/generated/ksp/main has been removed.
The input changes require a full rebuild for incremental task ':workload:kspKotlin'.
file or directory '/Users/sschroeder/IdeaProjects/ksp-service-logger-embedded/workload/src/main/kotlin', not found
file or directory '/Users/sschroeder/IdeaProjects/ksp-service-logger-embedded/workload/src/main/kotlin', not found
file or directory '/Users/sschroeder/IdeaProjects/ksp-service-logger-embedded/workload/src/main/kotlin', not found
i: found daemon on port 17939 (220000 ms old), trying to connect
i: connected to the daemon. Daemon is using following 'java' executable to run itself: /Users/sschroeder/.sdkman/candidates/java/8.0.292.hs-adpt/bin/java
e: java.lang.Throwable: options: {option1=value1, option2=value2}
so the exception is thrown which means the code is executed but the logged text is nowhere to be found :(
I've now pushed my code to GitHub, the Processor class is here: https://github.com/simon-void/ksp-service-logger-embedded/blob/main/logging-processor/src/main/kotlin/ServiceLoggerProcessor.kt The whole project is derived from the sample processor (playground.zip) from the KSP project's quickstart section: https://github.com/google/ksp/blob/main/docs/quickstart.md I increased the log-level to
logger.error(...)
but it makes no difference, it still doesn't show up.
j
I will take a look. We have a fix in upstream which will hopefully solve most issues around loggers, we will update it once kotlin 1.5.30 is released.
274 Views