java.lang.Object
java.util.logging.LogManager
org.glassfish.main.jul.GlassFishLogManager
The custom
LogManager implementation.
Main differences:
- Customized lifecycle allowing deferred or phased configuration, see
GlassFishLoggingStatus reset()method is not available except internal usage.- You can use
reconfigure(GlassFishLogManagerConfiguration)method instead. - Or you can use
reconfigure(GlassFishLogManagerConfiguration, Action, Action)method, which provides a way to add programatical extension points.
Note: Some methods have complicated implementation, the reason is that JDK LogManager is
not an example of well usable and well extensible class at all.
- Author:
- David Matejcek
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAction to be performed when client callsreconfigure(GlassFishLogManagerConfiguration, Action, Action) -
Field Summary
FieldsFields inherited from class java.util.logging.LogManager
LOGGING_MXBEAN_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidCloses allExternallyManagedLogHandlerinstances managed by this log manager.static GlassFishLogManagerReturns currentGlassFishLogManagerinstance.getProperty(String name) static booleanvoidDeprecated.voidreadConfiguration(InputStream input) Deprecated.voidReconfigures the logging system.voidreconfigure(GlassFishLogManagerConfiguration cfg, GlassFishLogManager.Action reconfigureAction, GlassFishLogManager.Action flushAction) Reconfigures the logging system.voidreset()Deprecated.voidupdateConfiguration(InputStream ins, Function<String, BiFunction<String, String, String>> mapper) Deprecated.voidupdateConfiguration(Function<String, BiFunction<String, String, String>> mapper) Deprecated.Methods inherited from class java.util.logging.LogManager
addConfigurationListener, checkAccess, getLoggerNames, getLoggingMXBean, removeConfigurationListener
-
Field Details
-
ROOT_LOGGER_NAME
Empty string - standard root logger name- See Also:
-
-
Constructor Details
-
GlassFishLogManager
Deprecated.Don't call this constructor directly. UseLogManager.getLogManager()instead. SeeLogManagerjavadoc for more.
-
-
Method Details
-
isGlassFishLogManager
public static boolean isGlassFishLogManager()- Returns:
- true if
GlassFishLogManageris configured as the JVM log manager.
-
getLogManager
Returns currentGlassFishLogManagerinstance.If it is not initialized yet, starts the initialization.
- Returns:
- null if the current
LogManageris not an instance of this class.
-
getProperty
- Overrides:
getPropertyin classLogManager
-
getConfiguration
- Returns:
- clone of internal configuration properties
-
addLogger
- Overrides:
addLoggerin classLogManager- Returns:
- false to force caller to refind the new logger, true to inform him that we did not add it.
-
getLogger
- Overrides:
getLoggerin classLogManager
-
reset
Deprecated.Don't use this method, it will not do anything in most cases. It is used just by theLogManageron startup and removes all handlers.- Overrides:
resetin classLogManager
-
readConfiguration
Deprecated.Does nothing!- Overrides:
readConfigurationin classLogManager- Throws:
SecurityExceptionIOException
-
readConfiguration
Deprecated.Don't use this method, it is here just for theLogManager. Usereconfigure(GlassFishLogManagerConfiguration)instead.- Overrides:
readConfigurationin classLogManager- Throws:
SecurityExceptionIOException
-
updateConfiguration
@Deprecated public void updateConfiguration(Function<String, BiFunction<String, throws IOExceptionString, String>> mapper) Deprecated.Does nothing!- Overrides:
updateConfigurationin classLogManager- Throws:
IOException
-
updateConfiguration
@Deprecated public void updateConfiguration(InputStream ins, Function<String, BiFunction<String, throws IOExceptionString, String>> mapper) Deprecated.Does nothing!- Overrides:
updateConfigurationin classLogManager- Throws:
IOException
-
getLoggingStatus
- Returns:
GlassFishLoggingStatus, never null
-
getAllLoggers
- Returns:
- all loggers currently managed by thus log manager (only from user context)
-
getAllHandlers
- Returns:
- all handlers currently managed by this log manager (only from user context)
-
getRootLogger
- Returns:
- can be null only when
LogManagerdoes initialization.
-
reconfigure
Reconfigures the logging system.- Parameters:
cfg-
-
reconfigure
public void reconfigure(GlassFishLogManagerConfiguration cfg, GlassFishLogManager.Action reconfigureAction, GlassFishLogManager.Action flushAction) Reconfigures the logging system.- Parameters:
cfg-reconfigureAction- - a callback executed after the reconfiguration of logger levels is finished. This action may perform some programmatic configuration.flushAction- - a callback executed after reconfigureAction to flush program'sLogRecordbuffers waiting until the reconfiguration is completed.
-
closeAllExternallyManagedLogHandlers
public void closeAllExternallyManagedLogHandlers()Closes allExternallyManagedLogHandlerinstances managed by this log manager. Should be called ie. by shutdown hooks to release all injected dependencies. Handlers must stop processing records after that.
-