Class ILog
The Loggers
class handles the available and registered loggers on a thread or thread group basis, or an instance of a class that can hold the particular instance data.
Optional arguments are placed in order where the formatting string contains open/close braces as "{}". If there are missing braces, each additional argument is placed on a numbered line below, indented with " - ", resulting in e.g. " - 1 = argument-as-string".
The following arguments are converted using "deep-toString" meaning their contents and subcontents are deep-toString'eg if possible, otherwise just as "toString()".
- null: "null".
- Array of primitives: the entire array is expanded.
- com.iizix.prop.StringMapProp or java.util.Map: lists all the contents on new lines as " - key = value".
- Throwable: expanded throwable with stack trace, including potential ignored exception and cause.
- Author:
- Christopher Mindus
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The CONFIG (=4) log event.static final int
The FINE (=5) log event.static final int
The FINER (=6) log event.static final int
The FINEST (=7) log event.static final int
The INFO (=3) log event.static final int
The SEVERE (=1) log event.static final int
The WARNING (=2) log event.Constructor Summary
Method Summary
Modifier and TypeMethodDescriptionvoid
Outputs a config log event.void
Outputs a config log event.void
Outputs a config log event.void
Outputs a config log event.static void
Outputs a config log event.static void
Outputs a config log event.static void
Outputs a config log event.static void
Outputs a config log event.static void
Outputs a config log event.static void
Outputs a config log event.static void
Outputs a config log event.static void
Outputs a config log event.static void
Call to indicate that a method is entered.static void
Call to indicate that a method is entered.static void
Call to indicate that a method is entered.void
Call to indicate that a method is entered.static void
Call to indicate that a method is entered.static void
Call to indicate that a method is entered.void
exiting()
Call to indicate that a method is exited.static void
Call to indicate that a method is exited.static void
Call to indicate that a method is exited with a return value.static void
Call to indicate that a method is exited.static void
Call to indicate that a method is exited with a return value.void
Outputs a fine log event.void
Outputs a fine log event.void
Outputs a fine log event.void
Outputs a fine log event.static void
Outputs a fine log event.static void
Outputs a fine log event.static void
Outputs a fine log event.static void
Outputs a fine log event.static void
Outputs a fine log event.static void
Outputs a fine log event.static void
Outputs a fine log event.static void
Outputs a fine log event.void
Outputs a finer log event.void
Outputs a finer log event.void
Outputs a finer log event.void
Outputs a finer log event.static void
Outputs a finer log event.static void
Outputs a finer log event.static void
Outputs a finer log event.static void
Outputs a finer log event.static void
Outputs a finer log event.static void
Outputs a finer log event.static void
Outputs a finer log event.static void
Outputs a finer log event.void
Outputs a finest log event.void
Outputs a finest log event.void
Outputs a finest log event.void
Outputs a finest log event.static void
Outputs a finest log event.static void
Outputs a finest log event.static void
Outputs a finest log event.static void
Outputs a finest log event.static void
Outputs a finest log event.static void
Outputs a finest log event.static void
Outputs a finest log event.static void
Outputs a finest log event.static String
Formats an array of parameters.static int
Gets the currently configured log level.static String
getShortenedClassName
(Class<?> clazz) Gets the shortened name of a class.static String
Gets the shortened name of a class.void
Outputs an info log event.void
Outputs an info log event.void
Outputs an info log event.void
Outputs an info log event.static void
Outputs an info log event.static void
Outputs an info log event.static void
Outputs an info log event.static void
Outputs an info log event.static void
Outputs an info log event.static void
Outputs an info log event.static void
Outputs an info log event.static void
Outputs an info log event.static boolean
isLogged
(int level) Checks if the event would normally be logged.static void
Logs an event.static void
Logs an event.static void
Logs an event.static void
Logs an event.static void
Logs an event.static void
Logs an event.static void
Logs an event.static int
mapJSLogLevelToJava
(int level) Maps the JavaScript log levels [0='DEBUG',1='INFO',2='WARN',3='ERROR',4='FATAL',5='NONE',6='ALWAYS'] to Java.static boolean
setLogLevel
(int newLevel) Changes the logger log level.void
Outputs a severe log event.void
Outputs a severe log event.void
Outputs a severe log event.void
Outputs a severe log event.static void
Outputs a severe log event.static void
Outputs a severe log event.static void
Outputs a severe log event.static void
Outputs a severe log event.static void
Outputs a severe log event.static void
Outputs a severe log event.static void
Outputs a severe log event.static void
Outputs a severe log event.void
Outputs a warning log event.void
Outputs a warning log event.void
Outputs a warning log event.void
Outputs a warning log event.static void
Outputs a warning log event.static void
Outputs a warning log event.static void
Outputs a warning log event.static void
Outputs a warning log event.static void
Outputs a warning log event.static void
Outputs a warning log event.static void
Outputs a warning log event.static void
Outputs a warning log event.
Field Details
SEVERE
public static final int SEVEREThe SEVERE (=1) log event.- See Also:
WARNING
public static final int WARNINGThe WARNING (=2) log event.- See Also:
INFO
public static final int INFOThe INFO (=3) log event.- See Also:
CONFIG
public static final int CONFIGThe CONFIG (=4) log event.- See Also:
FINE
public static final int FINEThe FINE (=5) log event.- See Also:
FINER
public static final int FINERThe FINER (=6) log event.- See Also:
FINEST
public static final int FINESTThe FINEST (=7) log event.- See Also:
Constructor Details
ILog
Creates an instance of the logger for an originator.- Parameters:
originator
- originating class
ILog
Creates an instance of a named logger.- Parameters:
name
- The name of the logger.
Method Details
mapJSLogLevelToJava
public static int mapJSLogLevelToJava(int level) Maps the JavaScript log levels [0='DEBUG',1='INFO',2='WARN',3='ERROR',4='FATAL',5='NONE',6='ALWAYS'] to Java. NONE and "n/a" maps to FINE.- Parameters:
level
- The JavaScript log level.- Returns:
- The Java log level.
getLogLevel
public static int getLogLevel()Gets the currently configured log level.- Returns:
- The current log level (1-7) SEVERE-FINEST.
setLogLevel
public static boolean setLogLevel(int newLevel) Changes the logger log level.- Parameters:
newLevel
- the new log level (1-7) SEVERE-FINEST.- Returns:
- true if any setting changed, false if same values were present.
isLogged
public static boolean isLogged(int level) Checks if the event would normally be logged. This call is typically used to avoid multiple log outputs one after another or if the message to log is very complex to compute in terms of String concatenation and building.The return value might be true but the event still not logged later on. This might be the case if some special filtering is applied in order to see just the log of e.g. a particular client, application or thread.
- Parameters:
level
- The log level.- Returns:
- true if the event is normally logged, false otherwise.
getShortenedClassName
Gets the shortened name of a class.- Parameters:
clazz
- The class, ornull
for "system".- Returns:
- The short form of the class name, or
system
ifclazz
isnull
. - See Also:
getShortenedClassName
Gets the shortened name of a class.The following list shows the names beginning with a prefix and what the replacement is:
- "com.iizix." -> "ci."
- "com.iizix.prop." -> "cip."
- "com.iizix.server." -> "cis."
- "com.iizigo." -> "cI."
- "org.eclipse.jetty." -> "oej."
- "org.eclipse.jetty.server." -> "oejs."
- Parameters:
cn
- The class name.- Returns:
- The short form of the class name (if any short for exists), or "system" if the
cn
parameter wasnull
.
entering
Call to indicate that a method is entered. If log level is set toFINER
or less, this will be logged. The method name is fetched implicitly. However, this assumes that the containing class has the following static member:private static ILog log = new ILog(ClassName.class);
- Parameters:
params
- Optional parameters
exiting
public void exiting()Call to indicate that a method is exited. If log level is set toFINER
or less, this will be logged.The method name is fetched implicitly from the call stack.. However, this assumes that the containing class has the following static member:
private static ILog log = new ILog(ClassName.class);
entering
Call to indicate that a method is entered. If log level is set toFINER
or less, this will be logged.- Parameters:
originator
- The originator classmethod
- The method name
entering
Call to indicate that a method is entered. If log level is set toFINER
or less, this will be logged.The
originator
parameter will be used to look up the class name from the instance.- Parameters:
originator
- The originator instancemethod
- The method name
entering
Call to indicate that a method is entered. If log level is set toFINER
or less, this will be logged.The
originator
parameter will be used to look up the class name from the instance.- Parameters:
originator
- The originator instancemethod
- The method name
entering
Call to indicate that a method is entered. If log level is set toFINER
or less, this will be logged.- Parameters:
originator
- the containing classmethod
- explicit method nameparam1
- the fist parameter
entering
Call to indicate that a method is entered. If log level is set toFINER
or less, this will be logged.- Parameters:
originator
- the containing classmethod
- explicit method nameparams
- list of parameters
exiting
Call to indicate that a method is exited. If log level is set toFINER
or less, this will be logged.- Parameters:
originator
- the containing classmethod
- explicit method name
exiting
Call to indicate that a method is exited. If log level is set toFINER
or less, this will be logged.- Parameters:
originator
- the originmethod
- explicit method name
exiting
Call to indicate that a method is exited with a return value. If log level is set toFINER
or less, this will be logged.- Parameters:
originator
- the containing classmethod
- explicit method nameresult
- the result
exiting
Call to indicate that a method is exited with a return value. If log level is set toFINER
or less, this will be logged.- Parameters:
originator
- the originmethod
- explicit method nameresult
- the result
format
Formats an array of parameters.- Parameters:
params
- List of parameters, ornull
for none.- Returns:
- The formatted string of parameters using
Utilities.toString(Object)
.
FINEST
Outputs a finest log event.- Parameters:
msg
- message to log
finest
Outputs a finest log event.- Parameters:
msg
- message to log
FINEST
Outputs a finest log event.- Parameters:
msg
- message to logparam1
- first parameter
finest
Outputs a finest log event.- Parameters:
msg
- message to logparam1
- first parameter
FINEST
Outputs a finest log event.- Parameters:
msg
- message to logparams
- parameters
finest
Outputs a finest log event.- Parameters:
msg
- message to logparams
- parameters
FINEST
Outputs a finest log event.- Parameters:
msg
- message to logthrown
- thrown exception
finest
Outputs a finest log event.- Parameters:
msg
- message to logthrown
- thrown exception
FINEST
Outputs a finest log event.- Parameters:
originator
- originating classmsg
- message
FINEST
Outputs a finest log event.- Parameters:
originator
- originating classmsg
- messageparam1
- first parameter
FINEST
Outputs a finest log event.- Parameters:
originator
- originating classmsg
- messageparams
- parameters
FINEST
Outputs a finest log event.- Parameters:
originator
- originating classmsg
- messagethrown
- thrown Exception
FINER
Outputs a finer log event.- Parameters:
msg
- message to log
finer
Outputs a finer log event.- Parameters:
msg
- message to log
FINER
Outputs a finer log event.- Parameters:
msg
- message to logparam1
- first parameter
finer
Outputs a finer log event.- Parameters:
msg
- message to logparam1
- first parameter
FINER
Outputs a finer log event.- Parameters:
msg
- message to logparams
- parameters
finer
Outputs a finer log event.- Parameters:
msg
- message to logparams
- parameters
FINER
Outputs a finer log event.- Parameters:
msg
- message to logthrown
- thrown exception
finer
Outputs a finer log event.- Parameters:
msg
- message to logthrown
- thrown exception
FINER
Outputs a finer log event.- Parameters:
originator
- originating classmsg
- message
FINER
Outputs a finer log event.- Parameters:
originator
- originating classmsg
- messageparam1
- first parameter
FINER
Outputs a finer log event.- Parameters:
originator
- originating classmsg
- messageparams
- parameters
FINER
Outputs a finer log event.- Parameters:
originator
- originating classmsg
- messagethrown
- thrown Exception
FINE
Outputs a fine log event.- Parameters:
msg
- message to log
fine
Outputs a fine log event.- Parameters:
msg
- message to log
FINE
Outputs a fine log event.- Parameters:
msg
- message to logparam1
- first parameter
fine
Outputs a fine log event.- Parameters:
msg
- message to logparam1
- first parameter
FINE
Outputs a fine log event.- Parameters:
msg
- message to logparams
- parameters
fine
Outputs a fine log event.- Parameters:
msg
- message to logparams
- parameters
FINE
Outputs a fine log event.- Parameters:
msg
- message to logthrown
- thrown exception
fine
Outputs a fine log event.- Parameters:
msg
- message to logthrown
- thrown exception
FINE
Outputs a fine log event.- Parameters:
originator
- originating classmsg
- message
FINE
Outputs a fine log event.- Parameters:
originator
- originating classmsg
- messageparam1
- first parameter
FINE
Outputs a fine log event.- Parameters:
originator
- originating classmsg
- messageparams
- parameters
FINE
Outputs a fine log event.- Parameters:
originator
- originating classmsg
- messagethrown
- thrown Exception
CONFIG
Outputs a config log event.- Parameters:
msg
- message to log
config
Outputs a config log event.- Parameters:
msg
- message to log
CONFIG
Outputs a config log event.- Parameters:
msg
- message to logparam1
- first parameter
config
Outputs a config log event.- Parameters:
msg
- message to logparam1
- first parameter
CONFIG
Outputs a config log event.- Parameters:
msg
- message to logparams
- parameters
config
Outputs a config log event.- Parameters:
msg
- message to logparams
- parameters
CONFIG
Outputs a config log event.- Parameters:
msg
- message to logthrown
- thrown exception
config
Outputs a config log event.- Parameters:
msg
- message to logthrown
- thrown exception
CONFIG
Outputs a config log event.- Parameters:
originator
- originating classmsg
- message
CONFIG
Outputs a config log event.- Parameters:
originator
- originating classmsg
- messageparam1
- first parameter
CONFIG
Outputs a config log event.- Parameters:
originator
- originating classmsg
- messageparams
- parameters
CONFIG
Outputs a config log event.- Parameters:
originator
- originating classmsg
- messagethrown
- thrown Exception
INFO
Outputs an info log event.- Parameters:
msg
- message to log
info
Outputs an info log event.- Parameters:
msg
- message to log
INFO
Outputs an info log event.- Parameters:
msg
- message to logparam1
- first parameter
info
Outputs an info log event.- Parameters:
msg
- message to logparam1
- first parameter
INFO
Outputs an info log event.- Parameters:
msg
- message to logparams
- parameters
info
Outputs an info log event.- Parameters:
msg
- message to logparams
- parameters
INFO
Outputs an info log event.- Parameters:
msg
- message to logthrown
- thrown exception
info
Outputs an info log event.- Parameters:
msg
- message to logthrown
- thrown exception
INFO
Outputs an info log event.- Parameters:
originator
- originating classmsg
- message
INFO
Outputs an info log event.- Parameters:
originator
- originating classmsg
- messageparam1
- first parameter
INFO
Outputs an info log event.- Parameters:
originator
- originating classmsg
- messageparams
- parameters
INFO
Outputs an info log event.- Parameters:
originator
- originating classmsg
- messagethrown
- thrown Exception
WARNING
Outputs a warning log event.- Parameters:
msg
- message to log
warning
Outputs a warning log event.- Parameters:
msg
- message to log
WARNING
Outputs a warning log event.- Parameters:
msg
- message to logparam1
- first parameter
warning
Outputs a warning log event.- Parameters:
msg
- message to logparam1
- first parameter
WARNING
Outputs a warning log event.- Parameters:
msg
- message to logparams
- parameters
warning
Outputs a warning log event.- Parameters:
msg
- message to logparams
- parameters
WARNING
Outputs a warning log event.- Parameters:
msg
- message to logthrown
- thrown exception
warning
Outputs a warning log event.- Parameters:
msg
- message to logthrown
- thrown exception
WARNING
Outputs a warning log event.- Parameters:
originator
- originating classmsg
- message
WARNING
Outputs a warning log event.- Parameters:
originator
- originating classmsg
- messageparam1
- first parameter
WARNING
Outputs a warning log event.- Parameters:
originator
- originating classmsg
- messageparams
- parameters
WARNING
Outputs a warning log event.- Parameters:
originator
- originating classmsg
- messagethrown
- thrown Exception
SEVERE
Outputs a severe log event.- Parameters:
msg
- message to log
severe
Outputs a severe log event.- Parameters:
msg
- message to log
SEVERE
Outputs a severe log event.- Parameters:
msg
- message to logparam1
- first parameter
severe
Outputs a severe log event.- Parameters:
msg
- message to logparam1
- first parameter
SEVERE
Outputs a severe log event.- Parameters:
msg
- message to logparams
- parameters
severe
Outputs a severe log event.- Parameters:
msg
- message to logparams
- parameters
SEVERE
Outputs a severe log event.- Parameters:
msg
- message to logthrown
- thrown exception
severe
Outputs a severe log event.- Parameters:
msg
- message to logthrown
- thrown exception
SEVERE
Outputs a severe log event.- Parameters:
originator
- originating classmsg
- message
SEVERE
Outputs a severe log event.- Parameters:
originator
- originating classmsg
- messageparam1
- first parameter
SEVERE
Outputs a severe log event.- Parameters:
originator
- originating classmsg
- messageparams
- parameters
SEVERE
Outputs a severe log event.- Parameters:
originator
- originating classmsg
- messagethrown
- thrown Exception
log
Logs an event.- Parameters:
level
- The log level.msg
- The message.
log
Logs an event.- Parameters:
level
- The log level.clazz
- Event originates from class.msg
- The message.
log
Logs an event.- Parameters:
level
- The log level.originator
- Event originates from class or logger name.msg
- The message.
log
Logs an event.- Parameters:
level
- The log level.clazz
- Event originates from class.msg
- The message.param1
- The single parameter.
log
Logs an event.- Parameters:
level
- The log level.originator
- Event originates from class or logger name.msg
- The message.param1
- The single parameter.
log
Logs an event.- Parameters:
level
- The log level.clazz
- Event originates from class.msg
- The message.params
- The list of parameters.
log
Logs an event.- Parameters:
level
- The log level.originator
- Event originates from class or logger name.msg
- The message.params
- The list of parameters.