You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Easier configuration of KotlinLoggingConfiguration.logStartupMessage #598
Per #587, setting KotlinLoggingConfiguration.logStartupMessage allows for not printing out the startup message, as long as it's called prior to any KotlinLogging initialization. Managing that initialization is a little awkward, as at least in my case I've got a bunch of top level private val log...s that get initialized before any call to main().
I've been able to get it to work with a strategically placed run{} block like josephlbarnett/leakycauldron@0622c91 to take care of my main(), but the message shows up still in tests / other entry points, could there be an easier way to get this set throughout a given project?
If you're working in jvm only we can add a system property for that in case it's simpler. For Example to configure it when starting the jvm with -Dkotlinlogging.disablestartupmessage.
If the default property cannot be set to false, is it possible to use something like an SPI mechanism so that it can be disabled by default at a lower level?
I think there are two KMP-friendly ways we could handle this internally so users don't have to change how they declare their loggers:
Option 1: Defer the Startup Message Print
Instead of printing the startup message immediately when the logger factory is initialized, we could delay printing it until the first actual logging call (e.g., the first time log.info() is invoked). This would give main() or test setups plenty of time to disable the message before it actually prints, while having practically zero performance impact if we use a simple thread-safe flag.
Option 2: expect/actual for Environment Config
We could introduce an internal expect function to resolve the default configuration value, falling back to environment properties where supported:
jsMain / wasmMain: Default to true
This would allow JVM and Native users to configure the setting globally via their build tools (like Gradle systemProperty) or command-line arguments, solving the test pollution issue entirely.
I'm open to either approach. Let me know what you think would work best.
Joining this discussion to ask: what's the rationale behind this startup message? Why is it needed and does it need to be opt-out rather than opt-in? I'm using kotlin-logging in a library (often) shipped in browser applications, and I imagine most applications won't want this message to appear in browser console logs, especially in production (during development it would be harmless, I suppose).
So now I'll probably disable this directly in the library for all consumers, but it feels icky to do so, as it seems to be global configuration which I'd be setting (possibly) for other libraries using kotlin-logging.
I think this message might be useful when initially trying to integrate kotlin-logging with a logging backend, but honestly I wouldn't expect a logging library to be logging messages by itself, especially by default. Would you consider making this behaviour opt-in instead?
Also joining this discussion: I just saw this startup message for the first time - and immediately went to look for how to disable it. Why was this even added? To me, this is just noise I don't care about and now I have to actively do "something" to get back to how it was before. Why?
Activity
github-actions commentedon Mar 7, 2026
Thank you for reporting an issue. See the wiki for documentation and slack for questions.
oshai commentedon Mar 9, 2026
If you're working in jvm only we can add a system property for that in case it's simpler. For Example to configure it when starting the jvm with
-Dkotlinlogging.disablestartupmessage.mymx2 commentedon Mar 13, 2026
If the default property cannot be set to false, is it possible to use something like an SPI mechanism so that it can be disabled by default at a lower level?
oshai commentedon Mar 13, 2026
can you give more details what that means?
mymx2 commentedon Mar 13, 2026
it would be something like:
spi codes
oshai commentedon Mar 13, 2026
I think there are two KMP-friendly ways we could handle this internally so users don't have to change how they declare their loggers:
Option 1: Defer the Startup Message Print
Instead of printing the startup message immediately when the logger factory is initialized, we could delay printing it until the first actual logging call (e.g., the first time log.info() is invoked). This would give main() or test setups plenty of time to disable the message before it actually prints, while having practically zero performance impact if we use a simple thread-safe flag.
Option 2: expect/actual for Environment Config
We could introduce an internal expect function to resolve the default configuration value, falling back to environment properties where supported:
This would allow JVM and Native users to configure the setting globally via their build tools (like Gradle systemProperty) or command-line arguments, solving the test pollution issue entirely.
I'm open to either approach. Let me know what you think would work best.
mymx2 commentedon Mar 14, 2026
Lazyinit would be better.
YarnSphere commentedon Mar 18, 2026
Joining this discussion to ask: what's the rationale behind this startup message? Why is it needed and does it need to be opt-out rather than opt-in? I'm using
kotlin-loggingin a library (often) shipped in browser applications, and I imagine most applications won't want this message to appear in browser console logs, especially in production (during development it would be harmless, I suppose).So now I'll probably disable this directly in the library for all consumers, but it feels icky to do so, as it seems to be global configuration which I'd be setting (possibly) for other libraries using
kotlin-logging.I think this message might be useful when initially trying to integrate
kotlin-loggingwith a logging backend, but honestly I wouldn't expect a logging library to be logging messages by itself, especially by default. Would you consider making this behaviour opt-in instead?EDIT: Just found the initial rationale in #584:
If the intent is simply to aid in debugging, I'm really not convinced that this should be enabled by default.
Zordid commentedon Apr 13, 2026
Also joining this discussion: I just saw this startup message for the first time - and immediately went to look for how to disable it. Why was this even added? To me, this is just noise I don't care about and now I have to actively do "something" to get back to how it was before. Why?
Fix #598: Allow external configuration of logStartupMessage via Prope…
oshai commentedon May 21, 2026
Rationale is explained here: #602 (comment)
I want the lib not to hide errors for first time users.
Hope that makes some sense and the provided silution helps.