This has been an issue for me since day one of working with the IJ sdk.
During development, i want to be able to log things and see them in the output in my IDEA (the one i’m developing with, where the gradle runIde task runs). I can only get the warnings and errors, but not info/debug/trace.
It seems to me is only possible to configure the logging into the sandbox ide log file, but nothing else.
I’ve already posted about this: Better way for configurring logging? but this post here explains my issue better, so apologies for the quasi-duplication
move the logs outside from the gradle build directory. This way, they won’t be deleted on gradle clean. I personally move all the sandboxed data elsewhere, because I want to keep the config of my sandboxed IDEs. And they’re versioned, per example my IJ 2024.2 sandboxed IDE goes to ./persisted-sandboxed/ij-2024, my RIDER 2025.1 sandboxed IDE goes to ./persisted-sandboxed/rider-2025, etc. just to avoid conflicts when testing with different IDE types and versions
in your build.gradle.kts, configure log levels (per example, DEBUG for your logs, WARN for the rest of the IDE)
when running gradle runIde, show the idea.log file. This is definitively better than the Gradle output. You can see TRACE, DEBUG AND INFO messages, and easily filter the logs (by level, category, etc.). This can be configured in your Run Configuration:
one last thing: never run gradle runIde. Instead, register a task (I named it “runIde2”, so I run gradle runIde2) that inherits from runIde. This is important because the runIde ignores some parameters. A workaround is to simply inherit from runIde (don’t ask me why this limitation exists…), and configure it like the regular runIde task. I registred my task this way: val runIde2 by intellijPlatformTesting.runIde.registering { ... }
That sounds very promising, could you please share more detailed setup in code? like how do you setup the custom runIde task, how do you configure the task to pickup the sandbox data, etc. any code you can share to make setting it up easier would be greatly appreciated and helpful
tasks {
val runIde2 by intellijPlatformTesting.runIde.registering {
task {
maxHeapSize = "2g"
// ignore "The IDE seems to be launched with a script launcher" startup warning https://youtrack.jetbrains.com/articles/SUPPORT-A-56
jvmArgs("-Dignore.ide.script.launcher.used=true")
// force detection of slow operations in EDT when playing with sandboxed IDE (SlowOperations.assertSlowOperationsAreAllowed) + enable internal mode (which enables the UI Inspector)
jvmArgs("-Dide.slow.operations.assertion=true")
jvmArgs("-Didea.is.internal=true")
jvmArgs(
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:HeapDumpPath=${rootProject.projectDir}/build/java_error_in_idea64.hprof",
"-XX:ErrorFile=${rootProject.projectDir}/build/java_error_in_idea64.log"
)
// disable hiding frequent exceptions in logs (annoying for debugging). See com.intellij.idea.IdeaLogger
jvmArgs("-Didea.logger.exception.expiration.minutes=0")
// disable the splash screen on startup because it may interrupt when debugging
args(listOf("nosplash"))
// configure logging
systemProperties(
"idea.log.debug.categories" to "#lermitage.intellij.extra.icons",
)
}
...
How to change the location of the sandboxed IDE files (config, log, system, plugins):
My myPersistedSandboxIDEDir variable looks like "${rootProject.projectDir}/.idea-sandbox/${findSandboxedIDEVersionStr(...)}" where findSandboxedIDEVersionStr() computes a directory name based on the IDE (IJ, IC, WS, RIDER…) and version.
As you can see, I store the sandboxed IDE files in the “.idea-sandbox” folder, not in “build/…”.
Thank you! that helps a lot actually. what i found is that the extra logs tab reveals this overlay with the “show log filter” option, which i can then set to any level or to all.
Would be good to get any thoughts from the platform team on this, re best practice or if this can be provided by the platform somehow