Class LogFactory
public class LogFactory
extends java.lang.Object
- Since:
- 13 Dec 2016
- Author:
- GedMarc
-
Method Summary
Modifier and Type Method Description static ConsoleSTDOutputHandlerconfigureConsoleColourOutput(java.util.logging.Level outputLevel)static ConsoleSTDOutputHandlerconfigureConsoleSingleLineOutput(java.util.logging.Level outputLevel)Configures all the JWebMP Loggers to log to console with the given output using the SingleLineFormatterstatic ConsoleSTDOutputHandlerconfigureConsoleSingleLineOutput(java.util.logging.Level outputLevel, boolean inverted)Configures all the JWebMP Loggers to log to console with the given output using the SingleLineFormatterstatic voidconfigureDefaultLogHiding()Sets some of the configurations to a not so floody logConsoleSTDOutputHandlergetConsoleLogger()Returns the console loggerstatic java.util.logging.LevelgetDefaultLevel()Returns the currently assigned default levelstatic LogFactorygetInstance()Returns an instance of the log factorystatic java.util.logging.LoggergetLog(java.lang.Class name)Alias for get loggerstatic java.util.logging.LoggergetLog(java.lang.String name)Alias for get loggerjava.util.logging.LoggergetLogger(java.lang.String name)Returns a logger in Async that may or may not log to the console according to configurationstatic booleanisLogToConsole()If we should ever log to consolestatic voidsetDefaultLevel(java.util.logging.Level level)Sets the default level on all the loggers currently associated, as well as any future loggersstatic voidsetGroupLevel(java.lang.String category, java.util.logging.Level newLevel)Sets the default level on all the loggers currently associated, as well as any future loggersstatic voidsetLogToConsole(boolean LogToConsole)If we should ever log to consoleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
configureConsoleColourOutput
public static ConsoleSTDOutputHandler configureConsoleColourOutput(java.util.logging.Level outputLevel) -
configureConsoleSingleLineOutput
public static ConsoleSTDOutputHandler configureConsoleSingleLineOutput(java.util.logging.Level outputLevel)Configures all the JWebMP Loggers to log to console with the given output using the SingleLineFormatter- Parameters:
outputLevel- The level to apply- Returns:
- The Handler that was added
-
configureConsoleSingleLineOutput
public static ConsoleSTDOutputHandler configureConsoleSingleLineOutput(java.util.logging.Level outputLevel, boolean inverted)Configures all the JWebMP Loggers to log to console with the given output using the SingleLineFormatter- Parameters:
outputLevel- The level to apply- Returns:
- The Handler that was added
-
configureDefaultLogHiding
public static void configureDefaultLogHiding()Sets some of the configurations to a not so floody logLogFactory.setGroupLevel("org.hibernate", Level.INFO); LogFactory.setGroupLevel("io.undertow.request", Level.INFO); LogFactory.setGroupLevel("jakarta.faces.component", Level.INFO); LogFactory.setGroupLevel("com.google.inject", Level.CONFIG); LogFactory.setGroupLevel("org.xnio", Level.INFO); LogFactory.setGroupLevel("btm", Level.INFO); LogFactory.setGroupLevel("com.microsoft.sqlserver.jdbc", Level.INFO); LogFactory.setGroupLevel("com.hazelcast", Level.INFO); LogFactory.setGroupLevel("jakarta.net", Level.INFO); LogFactory.setGroupLevel("org.apache.cxf", Level.CONFIG); LogFactory.setGroupLevel("jdk.event.security", Level.INFO); LogFactory.setGroupLevel("jakarta.xml.bind", Level.CONFIG); LogFactory.setGroupLevel("jakarta.enterprise.resource.webcontainer.jsf", Level.INFO);
-
getLog
public static java.util.logging.Logger getLog(java.lang.String name)Alias for get logger- Parameters:
name- Logger name to return- Returns:
- A JDK 8 Logger
-
getLogger
public java.util.logging.Logger getLogger(java.lang.String name)Returns a logger in Async that may or may not log to the console according to configuration- Parameters:
name- Returns the logger- Returns:
- The newly created logger
-
getInstance
Returns an instance of the log factory- Returns:
- The static instance
-
getDefaultLevel
public static java.util.logging.Level getDefaultLevel()Returns the currently assigned default level- Returns:
- The default level assigned to the
-
setGroupLevel
public static void setGroupLevel(java.lang.String category, java.util.logging.Level newLevel)Sets the default level on all the loggers currently associated, as well as any future loggers- Parameters:
newLevel- The default level to apply on all loggers on all registered handlers
-
setDefaultLevel
public static void setDefaultLevel(java.util.logging.Level level)Sets the default level on all the loggers currently associated, as well as any future loggers- Parameters:
level- The default level to apply on all loggers on all registered handlers
-
getLog
public static java.util.logging.Logger getLog(java.lang.Class name)Alias for get logger- Parameters:
name- Logger name to return- Returns:
- A JDK 8 Logger
-
isLogToConsole
public static boolean isLogToConsole()If we should ever log to console- Returns:
- If logging to console is enabled
-
setLogToConsole
public static void setLogToConsole(boolean LogToConsole)If we should ever log to console- Parameters:
LogToConsole- If must log to console
-
getConsoleLogger
Returns the console logger- Returns:
- The console logger instance
-