Package eu.cloudnetservice.common.log
Class LogManager
java.lang.Object
eu.cloudnetservice.common.log.LogManager
The log manager provides static access to underlying api to shortcut logger creation methods for easier
accessibility.
- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static @NonNull LoggerFactorySelects the logger factory use.Gets a logger from the current logger factory which has the name of the given class.Gets a logger from the current logger factory which has the given name.static @NonNull LoggerFactoryGets the current logger factory which the system uses.Gets the root logger for the system from the currently used logger factory.
-
Field Details
-
LOGGER_FACTORY
-
-
Constructor Details
-
LogManager
private LogManager()
-
-
Method Details
-
rootLogger
Gets the root logger for the system from the currently used logger factory.- Returns:
- the root logger.
-
logger
Gets a logger from the current logger factory which has the name of the given class.- Parameters:
caller- the class to get the logger for.- Returns:
- a logger with the name of the given class.
- Throws:
NullPointerException- if the given class is null.
-
logger
Gets a logger from the current logger factory which has the given name.- Parameters:
name- the name of the logger to get.- Returns:
- a logger with the given name.
- Throws:
NullPointerException- if the given name is null.
-
loggerFactory
Gets the current logger factory which the system uses. The factory is statically initialized with the class and will never change once initialized.- Returns:
- the current selected logger factory.
-
loadLoggerFactory
Selects the logger factory use. This method tries to load all providers for the logger factory class and uses the first one which is available (if any) and uses it as the factory for loggers. If no logger factory service is available on the class path this method falls back to the fallback logger factory which creates loggers wrapping java.util.logging loggers.- Returns:
- the logger factory to use in the runtime.
- Throws:
ServiceConfigurationError- if something went wrong during the service loading or instantiation.
-