Removed kotlinLogging, and reverted to standard slf4j

This commit is contained in:
Robinson 2021-04-26 00:26:45 +02:00
parent 15c4312d1e
commit 8ddb8d7738
6 changed files with 15 additions and 21 deletions

View File

@ -27,8 +27,8 @@ import dorkbox.executor.stream.IOStreamHandler
import dorkbox.executor.stream.PumpStreamHandler import dorkbox.executor.stream.PumpStreamHandler
import kotlinx.coroutines.* import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.Channel
import mu.KotlinLogging
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.slf4j.MDC import org.slf4j.MDC
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
import java.io.IOException import java.io.IOException
@ -79,7 +79,7 @@ class DeferredProcessResult internal constructor(private val process: Process,
companion object { companion object {
private val EOL = "\n".toByteArray(UTF_8) private val EOL = "\n".toByteArray(UTF_8)
private val log = KotlinLogging.logger {} private val log = LoggerFactory.getLogger(DeferredProcessResult::class.java)
/** /**
* In case [InvalidExitValueException] is thrown and we have read the process output we include the output up to this length * In case [InvalidExitValueException] is thrown and we have read the process output we include the output up to this length
@ -386,9 +386,7 @@ class DeferredProcessResult internal constructor(private val process: Process,
} catch (e: ExecutionException) { } catch (e: ExecutionException) {
throw IllegalStateException("Could not close streams of $process", e.cause) throw IllegalStateException("Could not close streams of $process", e.cause)
} catch (e: TimeoutCancellationException) { } catch (e: TimeoutCancellationException) {
log.warn { log.warn("Could not close streams of $process in ${params.closeTimeout} ${getUnitsAsString(params.closeTimeout, params.closeTimeoutUnit)}")
"Could not close streams of $process in ${params.closeTimeout} ${getUnitsAsString(params.closeTimeout, params.closeTimeoutUnit)}"
}
} }
} }
} }

View File

@ -39,7 +39,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import mu.KotlinLogging
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.io.* import java.io.*
@ -84,9 +83,9 @@ open class Executor {
/** /**
* Gets the version number. * Gets the version number.
*/ */
const val version = "3.1" const val version = "3.2"
val log = KotlinLogging.logger { } val log = LoggerFactory.getLogger(Executor::class.java)
val IS_OS_WINDOWS: Boolean val IS_OS_WINDOWS: Boolean
val IS_OS_MAC: Boolean val IS_OS_MAC: Boolean

View File

@ -19,7 +19,7 @@ package dorkbox.executor
import dorkbox.executor.exceptions.InvalidExitValueException import dorkbox.executor.exceptions.InvalidExitValueException
import dorkbox.executor.processResults.SyncProcessResult import dorkbox.executor.processResults.SyncProcessResult
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import mu.KotlinLogging import org.slf4j.LoggerFactory
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.util.concurrent.TimeoutException import java.util.concurrent.TimeoutException
@ -30,7 +30,7 @@ import java.util.concurrent.TimeoutException
class JvmExecOptions(private val executor: Executor) { class JvmExecOptions(private val executor: Executor) {
companion object { companion object {
private val log = KotlinLogging.logger { } private val log = LoggerFactory.getLogger(JvmExecOptions::class.java)
private val SPACE_REGEX = " ".toRegex() private val SPACE_REGEX = " ".toRegex()
@ -105,7 +105,7 @@ class JvmExecOptions(private val executor: Executor) {
File("java") File("java")
} }
log.error { "Unable to find JVM executable [java.home=" + System.getProperty("java.home") + "]! Using '$jvmExecutable' as the default" } log.error("Unable to find JVM executable [java.home=" + System.getProperty("java.home") + "]! Using '$jvmExecutable' as the default")
} }
return jvmExecutable!! return jvmExecutable!!
@ -150,7 +150,7 @@ class JvmExecOptions(private val executor: Executor) {
count++ count++
} catch (e: Exception) { } catch (e: Exception) {
log.error(e) { "Error processing classpath!!" } log.error("Error processing classpath!!", e)
} }
if (count < totalSize) { if (count < totalSize) {

View File

@ -19,7 +19,6 @@
package dorkbox.executor package dorkbox.executor
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.helpers.MarkerIgnoringBase
object LogHelper { object LogHelper {
fun fixSshLogger(log: Logger?) { fun fixSshLogger(log: Logger?) {
@ -106,7 +105,7 @@ object LogHelper {
* *
* This is NOT to be used for performant critical logs! * This is NOT to be used for performant critical logs!
*/ */
open class LogHelperLogger(name: String) : MarkerIgnoringBase() { open class LogHelperLogger(name: String) : org.slf4j.helpers.MarkerIgnoringBase() {
val logger = org.slf4j.LoggerFactory.getLogger(name)!! val logger = org.slf4j.LoggerFactory.getLogger(name)!!
/** /**

View File

@ -39,7 +39,7 @@
package dorkbox.executor.listener package dorkbox.executor.listener
import mu.KotlinLogging import org.slf4j.LoggerFactory
/** /**
* Destroys all registered Processes when the VM exits. * Destroys all registered Processes when the VM exits.
@ -57,7 +57,7 @@ import mu.KotlinLogging
*/ */
class ShutdownHookProcessDestroyer : ProcessDestroyer, Runnable { class ShutdownHookProcessDestroyer : ProcessDestroyer, Runnable {
companion object { companion object {
private val log = KotlinLogging.logger{} private val log = LoggerFactory.getLogger(ShutdownHookProcessDestroyer::class.java)
/** /**
* Singleton instance of the [ShutdownHookProcessDestroyer]. * Singleton instance of the [ShutdownHookProcessDestroyer].

View File

@ -44,7 +44,7 @@ import dorkbox.executor.Executor
import dorkbox.executor.stream.nopStreams.NopInputStream import dorkbox.executor.stream.nopStreams.NopInputStream
import kotlinx.coroutines.* import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.Channel
import mu.KotlinLogging import org.slf4j.LoggerFactory
import org.slf4j.MDC import org.slf4j.MDC
import java.io.IOException import java.io.IOException
import java.io.InputStream import java.io.InputStream
@ -114,7 +114,7 @@ class PumpStreamHandler(out: OutputStream = System.out,
asyncSupport: Boolean = false) : IOStreamHandler(out, err, input, asyncSupport) { asyncSupport: Boolean = false) : IOStreamHandler(out, err, input, asyncSupport) {
companion object { companion object {
private val log = KotlinLogging.logger {} private val log = LoggerFactory.getLogger(PumpStreamHandler::class.java)
/** /**
* the default size of the internal buffer for copying the streams * the default size of the internal buffer for copying the streams
@ -545,9 +545,7 @@ class PumpStreamHandler(out: OutputStream = System.out,
* So since Java 8 after UNIXProcess detects the exit and there's something in the output buffer closing this stream throws IOException * So since Java 8 after UNIXProcess detects the exit and there's something in the output buffer closing this stream throws IOException
* with message "Stream closed" from NullOutputStream. * with message "Stream closed" from NullOutputStream.
*/ */
log.trace(e) { log.trace("Failed to close process output stream", e)
"Failed to close process output stream:"
}
} }
else { else {
caught = add(caught, e) caught = add(caught, e)