Improve daemon client debug reports
Before this change a daemon client debug messages were printed only when the client could not connect and the 'kotlin.daemon.verbose' system property was set up. Now messages are printed if the debug logging is enabled and the 'kotlin.daemon.verbose' is set up.
This commit is contained in:
+7
-1
@@ -42,6 +42,8 @@ interface KotlinLogger {
|
|||||||
fun warn(msg: String)
|
fun warn(msg: String)
|
||||||
fun info(msg: String)
|
fun info(msg: String)
|
||||||
fun debug(msg: String)
|
fun debug(msg: String)
|
||||||
|
|
||||||
|
val isDebugEnabled: Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class KotlinCompilerRunner<in Env : CompilerEnvironment> {
|
abstract class KotlinCompilerRunner<in Env : CompilerEnvironment> {
|
||||||
@@ -61,11 +63,15 @@ abstract class KotlinCompilerRunner<in Env : CompilerEnvironment> {
|
|||||||
val daemonJVMOptions = configureDaemonJVMOptions(inheritMemoryLimits = true, inheritAdditionalProperties = true)
|
val daemonJVMOptions = configureDaemonJVMOptions(inheritMemoryLimits = true, inheritAdditionalProperties = true)
|
||||||
|
|
||||||
val daemonReportMessages = ArrayList<DaemonReportMessage>()
|
val daemonReportMessages = ArrayList<DaemonReportMessage>()
|
||||||
|
val daemonReportingTargets = when {
|
||||||
|
log.isDebugEnabled -> DaemonReportingTargets(messages = daemonReportMessages)
|
||||||
|
else -> DaemonReportingTargets(messageCollector = environment.messageCollector)
|
||||||
|
}
|
||||||
|
|
||||||
val profiler = if (daemonOptions.reportPerf) WallAndThreadAndMemoryTotalProfiler(withGC = false) else DummyProfiler()
|
val profiler = if (daemonOptions.reportPerf) WallAndThreadAndMemoryTotalProfiler(withGC = false) else DummyProfiler()
|
||||||
|
|
||||||
val connection = profiler.withMeasure(null) {
|
val connection = profiler.withMeasure(null) {
|
||||||
val daemon = KotlinCompilerClient.connectToCompileService(compilerId, daemonJVMOptions, daemonOptions, DaemonReportingTargets(null, daemonReportMessages), true, true)
|
val daemon = KotlinCompilerClient.connectToCompileService(compilerId, daemonJVMOptions, daemonOptions, daemonReportingTargets, true, true)
|
||||||
DaemonConnection(daemon, daemon?.leaseCompileSession(flagFile.absolutePath)?.get() ?: CompileService.NO_SESSION)
|
DaemonConnection(daemon, daemon?.leaseCompileSession(flagFile.absolutePath)?.get() ?: CompileService.NO_SESSION)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -395,11 +395,13 @@ object KotlinCompilerClient {
|
|||||||
daemon.inputStream
|
daemon.inputStream
|
||||||
.reader()
|
.reader()
|
||||||
.forEachLine {
|
.forEachLine {
|
||||||
|
reportingTargets.report(DaemonReportCategory.DEBUG, it, "daemon")
|
||||||
|
|
||||||
if (it == COMPILE_DAEMON_IS_READY_MESSAGE) {
|
if (it == COMPILE_DAEMON_IS_READY_MESSAGE) {
|
||||||
|
reportingTargets.report(DaemonReportCategory.DEBUG, "Received the message signalling that the daemon is ready")
|
||||||
isEchoRead.release()
|
isEchoRead.release()
|
||||||
return@forEachLine
|
return@forEachLine
|
||||||
}
|
}
|
||||||
reportingTargets.report(DaemonReportCategory.DEBUG, it, "daemon")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|||||||
@@ -34,4 +34,7 @@ internal class JpsKotlinLogger(private val log: Logger) : KotlinLogger {
|
|||||||
override fun debug(msg: String) {
|
override fun debug(msg: String) {
|
||||||
log.debug(msg)
|
log.debug(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val isDebugEnabled: Boolean
|
||||||
|
get() = log.isDebugEnabled
|
||||||
}
|
}
|
||||||
+3
@@ -34,4 +34,7 @@ internal class GradleKotlinLogger(private val log: Logger) : KotlinLogger {
|
|||||||
override fun warn(msg: String) {
|
override fun warn(msg: String) {
|
||||||
log.warn(msg)
|
log.warn(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val isDebugEnabled: Boolean
|
||||||
|
get() = log.isDebugEnabled
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user