Module io.jstach.rainbowgum.jdk
heavy initialization should not happen
.
The integration will make sure that neither the System.Logger or
java.util.logging will initialize Rainbow Gum too early by queueing the
events if a
RainbowGumServiceProvider.RainbowGumEagerLoad
implementation is found (SLF4J facade implements this to indicate it will load Rainbow Gum).
When a Rainbow Gum initializes and
set as global the
events will be replayed. If the events level are equal to
System.Logger.Level.ERROR
and a normal Rainbow Gum has not
been bound the messages will be printed to System.err
. The idea
is something catastrophic has happened that will probably cause Rainbow Gum
to never load and thus never replay the events and you will not be able to
figure out what happened. If no
RainbowGumServiceProvider.RainbowGumEagerLoad
is found the SystemLogger will initialize Rainbow Gum. You can change the queuing
threshold and error level outputting with System properties:
- "logging.global.queue.level" = level
- "logging.global.queue.error" = level
SLF4J does provide an adapter/bridge for the System.Logger (org.slf4j:slf4j-jdk-platform-logging) but its use may cause Rainbow Gum to initialize too early. However that maybe desirable if:
- You are sure that Rainbow Gum can initialize early
- Your application uses System.Logger (the SLF4J adapter will initialize
Rainbow Gum on Sytem.Logger usage if using
io.jstach.rainbowgum.slf4j
module)
"logging.systemlogger.initialize"
to
the values in RainbowGumSystemLoggerFinder.InitOption
.
however that maybe difficult if one cannot set system properties before loading logging.
To disable installation of the java.util.logging handler set the property:
"logging.jul.disable"
to true
. Alternatively if in a custom modular environment using jlink and
the module java.logging
is not included the handler will not be installed.
Furthermore
the module java.logging
is not required and thus
jlink might not automatically include it as it is requires static
.
Because the logger names of System.Logger and JUL are far less likely to be actual class names and could be anything (unlike SLF4J which encourages class names and static loggers) Rainbow Gum does not cache System.Loggers.
-
Packages
-
Services