Michael Strasser
02/07/2024, 5:58 AMStefan Oltmann
02/07/2024, 6:50 AMMichael Strasser
02/07/2024, 6:54 AMStefan Oltmann
02/07/2024, 7:25 AMStefan Oltmann
02/07/2024, 7:27 AMStefan Oltmann
02/07/2024, 7:31 AMStefan Oltmann
02/07/2024, 7:35 AMMichael Paus
02/07/2024, 9:31 AMStefan Oltmann
02/07/2024, 9:36 AMdarkmoon_uk
02/07/2024, 10:34 AMStefan Oltmann
02/07/2024, 11:33 AMrocketraman
02/07/2024, 5:21 PMThese libraries (mostly) wrap underlying Java libraries and suffer from the same limitations.Log4j Kotlin supports coroutine based logging context just like klogging. Log4j also supports structured logging via the JSON layout, and uses nanotime for log events, so I don't think it suffers from any of the limitations you listed. Thoughts?
Stefan Oltmann
02/07/2024, 8:06 PMrocketraman
02/07/2024, 8:09 PMStefan Oltmann
02/07/2024, 8:09 PMrocketraman
02/07/2024, 8:10 PMStefan Oltmann
02/07/2024, 8:10 PMrocketraman
02/07/2024, 8:11 PMStefan Oltmann
02/07/2024, 8:12 PMStefan Oltmann
02/07/2024, 8:13 PMrocketraman
02/07/2024, 8:14 PMrocketraman
02/07/2024, 8:15 PMStefan Oltmann
02/07/2024, 8:16 PMrocketraman
02/07/2024, 8:17 PMStefan Oltmann
02/07/2024, 8:17 PMStefan Oltmann
02/07/2024, 8:18 PMStefan Oltmann
02/07/2024, 8:19 PMStefan Oltmann
02/07/2024, 8:19 PMStefan Oltmann
02/07/2024, 8:20 PMStefan Oltmann
02/07/2024, 8:22 PMrocketraman
02/07/2024, 8:30 PMlog4j.xml
or logback.xml
or what have you -- users of a true multi-platform slf4k still have to configure every platform's underlying loggingStefan Oltmann
02/07/2024, 8:40 PMrocketraman
02/07/2024, 8:40 PMStefan Oltmann
02/07/2024, 8:41 PMStefan Oltmann
02/07/2024, 8:44 PMStefan Oltmann
02/07/2024, 8:45 PMrocketraman
02/07/2024, 8:46 PMrocketraman
02/07/2024, 8:47 PMrocketraman
02/07/2024, 8:48 PMStefan Oltmann
02/07/2024, 8:50 PMrocketraman
02/07/2024, 8:52 PMAnd as it has been established and is known to many a slf4k that is a slf4j drop in replacement on the JVM will have a very high acceptance. Promised.Not sure about this. The proliferation you see in kotlin logging frameworks is all on the API side. They all use the same backends as usual -- on the JVM log4j2 or logback, etc.
You could be the driver for that, Raman. That’s what I’m talking about. 😄I know that's what you're saying but I don't think so. The process of competing frameworks being invented and being experimented with in the wild needs to happen first.
Stefan Oltmann
02/07/2024, 8:53 PMThe APIs already exist, see kotlin-logging, logging-log4j-kotlin, klogging, kflogger, kermit, and more.That’s not what I meant. These are logger implementations, each with its own API. Like every library has an API. I’m talking about THE logging api. This does NOT exist for Kotlin. Slf4j is THE logging API in the Java world.
rocketraman
02/07/2024, 8:54 PMStefan Oltmann
02/07/2024, 8:57 PMrocketraman
02/07/2024, 8:58 PMStefan Oltmann
02/07/2024, 8:59 PMrocketraman
02/07/2024, 9:02 PMStefan Oltmann
02/07/2024, 9:04 PMrocketraman
02/07/2024, 9:04 PMrocketraman
02/07/2024, 9:04 PMStefan Oltmann
02/07/2024, 9:06 PMStefan Oltmann
02/07/2024, 9:08 PMStefan Oltmann
02/07/2024, 9:09 PMMichael Strasser
02/08/2024, 7:25 AMLogContext
class that is like both ContextMap
and CoroutineThreadContext
in Log4j Kotlin. It has a complete set of suspend
logging functions to call within coroutine scopes that include any items from the log context (it can also include information from SLF4J MDC and other contexts if wanted). Klogging also uses coroutines to process log events asynchronously.rocketraman
02/08/2024, 6:35 PMwithContext(<http://Dispatchers.IO|Dispatchers.IO>)
, so that means klogging has no choice but to do the actual logging I/O async non-blocking WRT the logging API cal. And if that's the case, then why incur the cost of having logging calls be suspending?
> Klogging also uses coroutines to process log events asynchronously.
Interesting and nice as a library author, but for a user, its an implementation detail. Unlike something like say Ktor where the use of coroutines is fundamental to the user's API surface.