- java.lang.Object
-
- de.carne.util.logging.Logs
-
public final class Logs extends java.lang.ObjectUtility class providing Log related functions.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONFIG_BOOTName of pre-defined boot logging config.static java.lang.StringCONFIG_DEBUGStandard name for debug logging config.static java.lang.StringCONFIG_DEFAULTStandard name for default logging config.static java.lang.StringCONFIG_VERBOSEStandard name for verbose logging config.static java.util.logging.ErrorManagerDEFAULT_ERROR_MANAGERDefault ErrorManager instance to use for error reporting.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidapplyLevelConfig(java.lang.String levelConfig)Applies individual level configuration to the current configuration.static voidflush()FLushs all currently configured Handler instance (e.g. during application exit).static booleangetBooleanProperty(java.util.logging.LogManager manager, java.lang.String name, boolean defaultValue)Gets abooleanproperty from a LogManager's current configuration.static @Nullable java.util.logging.FiltergetFilterProperty(java.util.logging.LogManager manager, java.lang.String name, @Nullable java.util.logging.Filter defaultValue)Gets a Filter property from a LogManager's current configuration.static java.util.logging.FormattergetFormatterProperty(java.util.logging.LogManager manager, java.lang.String name, java.util.logging.Formatter defaultValue)Gets a Formatter property from a LogManager's current configuration.static intgetIntProperty(java.util.logging.LogManager manager, java.lang.String name, int defaultValue)Gets aintproperty from a LogManager's current configuration.static java.util.logging.LevelgetLevelProperty(java.util.logging.LogManager manager, java.lang.String name, LogLevel defaultValue)Gets a Level property from a LogManager's current configuration.static java.lang.StringgetStringProperty(java.util.logging.LogManager manager, java.lang.String name, java.lang.String defaultValue)Gets aStringproperty from a LogManager's current configuration.static @NonNull java.lang.String[]getStringsProperty(java.util.logging.LogManager manager, java.lang.String name)Gets aStringarray property from a LogManager's current configuration.static voidreadConfig(java.lang.String config)Reads and applies a LogManager configuration.static voidreadConfig(java.net.URL config)Reads and applies a LogManager configuration.
-
-
-
Field Detail
-
CONFIG_BOOT
public static final java.lang.String CONFIG_BOOT
Name of pre-defined boot logging config.- See Also:
- Constant Field Values
-
DEFAULT_ERROR_MANAGER
public static final java.util.logging.ErrorManager DEFAULT_ERROR_MANAGER
Default ErrorManager instance to use for error reporting.
-
CONFIG_DEFAULT
public static final java.lang.String CONFIG_DEFAULT
Standard name for default logging config.- See Also:
- Constant Field Values
-
CONFIG_VERBOSE
public static final java.lang.String CONFIG_VERBOSE
Standard name for verbose logging config.- See Also:
- Constant Field Values
-
CONFIG_DEBUG
public static final java.lang.String CONFIG_DEBUG
Standard name for debug logging config.- See Also:
- Constant Field Values
-
-
Method Detail
-
flush
public static void flush()
FLushs all currently configured Handler instance (e.g. during application exit).
-
readConfig
public static void readConfig(java.lang.String config) throws java.io.IOExceptionReads and applies a LogManager configuration.- Parameters:
config- the name of the configuration to read.- Throws:
java.io.IOException- if an I/O error occurs while reading the configuration.
-
readConfig
public static void readConfig(java.net.URL config) throws java.io.IOExceptionReads and applies a LogManager configuration.- Parameters:
config- the URL of the configuration to read.- Throws:
java.io.IOException- if an I/O error occurs while reading the configuration.
-
applyLevelConfig
public static void applyLevelConfig(java.lang.String levelConfig)
Applies individual level configuration to the current configuration.The level configuration to apply is defined as follows:
(<logger name>=<level name>)*- Parameters:
levelConfig- the level configuration to apply.
-
getStringProperty
public static java.lang.String getStringProperty(java.util.logging.LogManager manager, java.lang.String name, java.lang.String defaultValue)Gets aStringproperty from a LogManager's current configuration.- Parameters:
manager- the LogManager to get the configuration from.name- the property name to evaluate.defaultValue- the the default value to return in case the property is undefined.- Returns:
- the defined value or the default value if the property is undefined.
-
getStringsProperty
public static @NonNull java.lang.String[] getStringsProperty(java.util.logging.LogManager manager, java.lang.String name)Gets aStringarray property from a LogManager's current configuration.- Parameters:
manager- the LogManager to get the configuration from.name- the property name to evaluate.- Returns:
- the defined value or the default value if the property is undefined.
-
getIntProperty
public static int getIntProperty(java.util.logging.LogManager manager, java.lang.String name, int defaultValue)Gets aintproperty from a LogManager's current configuration.- Parameters:
manager- the LogManager to get the configuration from.name- the property name to evaluate.defaultValue- the the default value to return in case the property is undefined.- Returns:
- the defined value or the default value if the property is undefined.
-
getBooleanProperty
public static boolean getBooleanProperty(java.util.logging.LogManager manager, java.lang.String name, boolean defaultValue)Gets abooleanproperty from a LogManager's current configuration.- Parameters:
manager- the LogManager to get the configuration from.name- the property name to evaluate.defaultValue- the the default value to return in case the property is undefined.- Returns:
- the defined value or the default value if the property is undefined.
-
getLevelProperty
public static java.util.logging.Level getLevelProperty(java.util.logging.LogManager manager, java.lang.String name, LogLevel defaultValue)Gets a Level property from a LogManager's current configuration.- Parameters:
manager- the LogManager to get the configuration from.name- the property name to evaluate.defaultValue- the the default value to return in case the property is undefined.- Returns:
- the defined value or the default value if the property is undefined.
-
getFilterProperty
public static @Nullable java.util.logging.Filter getFilterProperty(java.util.logging.LogManager manager, java.lang.String name, @Nullable java.util.logging.Filter defaultValue)Gets a Filter property from a LogManager's current configuration.- Parameters:
manager- the LogManager to get the configuration from.name- the property name to evaluate.defaultValue- the the default value to return in case the property is undefined.- Returns:
- the defined value or the default value if the property is undefined.
-
getFormatterProperty
public static java.util.logging.Formatter getFormatterProperty(java.util.logging.LogManager manager, java.lang.String name, java.util.logging.Formatter defaultValue)Gets a Formatter property from a LogManager's current configuration.- Parameters:
manager- the LogManager to get the configuration from.name- the property name to evaluate.defaultValue- the the default value to return in case the property is undefined.- Returns:
- the defined value or the default value if the property is undefined.
-
-