christophsturm
06/14/2017, 12:19 PMcodeslubber
06/14/2017, 3:18 PMdeviant
08/09/2018, 1:23 PMKonstantin Petrukhnov
09/11/2018, 4:27 PMcmgurba
10/18/2018, 2:29 PMShan
02/25/2019, 1:07 AMSimpleLogger
with configuration System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "TRACE")
but could still not see trace level logs. I then switched to slf4j-log4j12
to rule out SimpleLogger
issues, with config file log4j.rootLogger=TRACE, STDOUT
log4j.logger.deng=TRACE
log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
log4j.appender.STDOUT.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
and still no trace logs show. Any ideas what I'm doing wrong?Nikky
02/27/2019, 4:36 PMNikky
02/27/2019, 11:05 PMNikky
03/01/2019, 1:52 PM14:49:03.787 [main] .(null:7) INFO - >>>> executing step two
instead of null i would expect scriptFile.ktszjuhasz
04/04/2019, 6:26 PM@PublishedApi internal val logger = KotlinLogging.logger {}
but that would get confusing with my other loggers. Should I just give it a unique name or is there a better way?Uzi Landsmann
05/21/2019, 4:15 AMcorneil
08/08/2019, 2:39 PMNikky
10/12/2019, 7:47 PMmsg: () -> Any?
not inline
, that would make some stuff where i call suspending stuff possible
i guess that would break compatibility with the slf4j stuff ?Nikky
10/12/2019, 7:48 PMNikky
10/12/2019, 9:38 PMKonstantin Petrukhnov
02/10/2020, 11:23 AMcorneil
02/10/2020, 1:41 PMval logger = KotlinLogging.logger {}
you should be able to use it anywhere.corneil
02/11/2020, 1:01 PMnapperley
06/21/2020, 1:24 AMbsimmons
07/06/2020, 6:15 PMDennis Schröder
08/26/2020, 7:05 AMvitaliy
08/27/2020, 9:28 AM<http://logger.info|logger.info>("blah $foo $bar")
vs <http://logger.info|logger.info> { "blah $foo $bar" }
. I suppose:
1. in the first case the string template is always constructed
2. in the second one only when the log level is set to make it visible. But there is extra lambda, etc.
Is it something I should worry about under a rather intensive load (backend) or it’s not worth optimizing?oshai
09/15/2020, 8:28 PMkotlin-logging
to kotlin-logging-jvm
In order to try it:
repositories {
maven { url '<https://oss.jfrog.org/artifactory/oss-snapshot-local>' }
}
dependencies {
compile('io.github.microutils:kotlin-logging-jvm:2.0.0-SNAPSHOT')
}
TwoClocks
10/27/2020, 1:46 AMNikky
11/01/2020, 12:33 PMAlec Muffett
11/06/2020, 2:57 PMimport ...
private val logger: KLogger = KotlinLogging.logger {}
internal class Engine(private val di: DI) {
fun mainMethod(args: Array<String>) { // called from "real" main()
System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG")
logger.trace("trace")
logger.debug("debug")
<http://logger.info|logger.info>("info")
logger.warn("warning")
logger.error("error")
...and when it runs, it is (sensibly) printing:
[main] DEBUG psm.Engine - debug
[main] INFO psm.Engine - info
[main] WARN psm.Engine - warning
[main] ERROR psm.Engine - error
HOWEVER: as soon as I declare another logger: KLogger = KotlinLogging.logger {}
in another classfile in the same package, the behaviour *changes*; more in comments:TwoClocks
11/10/2020, 8:29 AMNikky
11/12/2020, 11:04 AMprivate val exceptionHandler = CoroutineExceptionHandler { context, e -> GlobalScope.launch(MDCContext() + context) {
can i somehow do context.getCopyOfContextMap()
?Francois Stiennon
12/21/2020, 7:41 PMchristophsturm
01/19/2021, 1:25 PMchristophsturm
01/19/2021, 1:25 PMoshai
01/24/2021, 10:04 PMchristophsturm
01/24/2021, 10:07 PMimplementation("io.github.microutils:kotlin-logging:2.0.4")
implementation("org.apache.logging.log4j:log4j-core:$log4j2Version")
implementation("org.apache.logging.log4j:log4j-api:$log4j2Version")
implementation("org.apache.logging.log4j:log4j-jul:$log4j2Version")
implementation("org.apache.logging.log4j:log4j-slf4j18-impl:$log4j2Version")
oshai
01/25/2021, 4:22 AMchristophsturm
02/20/2021, 1:01 PM