| java.lang.Object org.openlaszlo.iv.flash.util.Log
Log | public class Log (Code) | | Logger
After replacing jgenerator native logging system with log4j
all the jgenerator classes like FileLogger, ConsoleLogger etc. are gone.
But I decided to keep this class Log to avoid changing a lot of code
which uses it.
Instead I changed its implementation to make it a wrapper for log4j.
log4j has several level methods, like 'debug', 'warn' etc., but jgenerator Log
has only one method 'log' which takes the level of a message from its
resource key's first character. I preserved this schema, so now if you use
this class's log method it will call corresponding log4j method based
on the first character of the message key, otherwise you can call any of
log4j methods directly or using new Log methods with the same signature.
The default initialization procedure:
- get property org.openlaszlo.iv.flash.log4j.configuration from iv.property file
- if it exists and contains valid url or file name (either relative to jgen home or absolute)
then use this url to initialize log4j (it can be either xml or property based configuration)
- if the property does not exist or is not valid then use standard log4 initialization procedure,
i.e. read system property log4j.configuration etc
author: Dmitry Skavish |
Method Summary | |
protected static void | _log(Level level, String key, Object[] parms, Throwable t) | protected static void | _logif(String key, Object[] parms, Throwable t) | protected static void | _logif(Level level, String key, Object[] parms, Throwable t) | public static void | debug(Object msg) | public static void | debug(Object msg, Throwable t) | public static void | debugRB(String key, Object[] parms) | public static void | debugRB(String key, Object[] parms, Throwable t) | public static void | error(Object msg) | public static void | error(Object msg, Throwable t) | public static void | errorRB(String key, Object[] parms) | public static void | errorRB(String key, Object[] parms, Throwable t) | public static void | fatal(Object msg) | public static void | fatal(Object msg, Throwable t) | public static void | fatalRB(String key, Object[] parms) | public static void | fatalRB(String key, Object[] parms, Throwable t) | public static Logger | getLogger() | public static String | getMessage(String key, Object[] parms) | public static String | getMessage(ResourceBundle rb, String key, Object[] parms) | public static Level | getMessageLevel(String key) | public static void | info(Object msg) | public static void | info(Object msg, Throwable t) | public static void | infoRB(String key, Object[] parms) | public static void | infoRB(String key, Object[] parms, Throwable t) | public static void | log(IVException e) | public static void | log(Throwable t) | public static void | logRB(IVException e) | public static void | logRB(Throwable t) | public static void | logRB(String key, Object[] p, Throwable t) | public static void | logRB(String key, Object[] p) | public static void | logRB(String key) | public static void | logRB(String key, Throwable t) | public static void | setDebugLevel() | public static void | setErrorLevel() | public static void | setFatalLevel() | public static void | setInfoLevel() | public static void | setLogToConsole() | public static void | setLogger(Logger logger) | public static void | setWarnLevel() | public static void | warn(Object msg) | public static void | warn(Object msg, Throwable t) | public static void | warnRB(String key, Object[] parms) | public static void | warnRB(String key, Object[] parms, Throwable t) |
_log | protected static void _log(Level level, String key, Object[] parms, Throwable t)(Code) | | Logs specified message to current logger
This method does not call those methods in Logger which are supposed
to be used, but instead calls appenders directly thus avoiding double
checking for levels, however this can be easily replaced with standard
method, just swap the comments
Parameters: level - specified logger level Parameters: key - message key Parameters: parms - optional message parameters Parameters: t - optional exception |
_logif | protected static void _logif(String key, Object[] parms, Throwable t)(Code) | | Checks if specified message is enabled under current level and logs the message if it is
Parameters: key - message key Parameters: parms - optional message parameters Parameters: t - optional exception |
_logif | protected static void _logif(Level level, String key, Object[] parms, Throwable t)(Code) | | Checks if specified level is enabled and logs the message if it is
Parameters: level - specified logger level Parameters: key - message key Parameters: parms - optional message parameters Parameters: t - optional exception |
getLogger | public static Logger getLogger()(Code) | | Gets current logger
current logger |
getMessage | public static String getMessage(String key, Object[] parms)(Code) | | Retrieves and formats a message given by its resource key
The messages is retrieved from resource bundle associated with current logger,
then formatted using java.util.MessageFormat
Parameters: key - resource key, if message is not found in the resource then the key is used as a message Parameters: parms - optional parameters formatted message |
getMessage | public static String getMessage(ResourceBundle rb, String key, Object[] parms)(Code) | | Retrieves and formats a message given by its resource key
The messages is retrieved from specified resource bundle or from standard jgenerator
bundle if the specified one is null, then the message is formatted using java.util.MessageFormat
Parameters: rb - specified resource bundle Parameters: key - resource key, if message is not found in the resource then the key is used as a message Parameters: parms - optional parameters formatted message |
getMessageLevel | public static Level getMessageLevel(String key)(Code) | | Checks if a messages specified by given key is enabled under current log level
Parameters: key - message key true if message has to be logged |
logRB | public static void logRB(IVException e)(Code) | | Logs IVException
IVException contains message with parameters inside
and probably nested exception
Parameters: e - exception to log |
logRB | public static void logRB(Throwable t)(Code) | | Logs Exception
Parameters: e - exception to log |
logRB | public static void logRB(String key, Object[] p, Throwable t)(Code) | | Logs exception as message specified by its resource key
Parameters: key - resource key Parameters: p - array of parameters Parameters: t - exception to log |
logRB | public static void logRB(String key, Object[] p)(Code) | | Logs exception as message specified by its resource key
Parameters: key - resource key Parameters: p - array of parameters |
logRB | public static void logRB(String key)(Code) | | Logs exception as message specified by its resource key
Parameters: key - resource key Parameters: p - array of parameters |
logRB | public static void logRB(String key, Throwable t)(Code) | | Logs exception as message specified by its resource key
Parameters: key - resource key Parameters: p - array of parameters |
setDebugLevel | public static void setDebugLevel()(Code) | | |
setErrorLevel | public static void setErrorLevel()(Code) | | |
setFatalLevel | public static void setFatalLevel()(Code) | | |
setInfoLevel | public static void setInfoLevel()(Code) | | |
setLogToConsole | public static void setLogToConsole()(Code) | | Sets log to console
|
setLogger | public static void setLogger(Logger logger)(Code) | | Sets new logger
If you set new logger you probably also need to set ResourceBundle to it
Parameters: logger - new logger |
setWarnLevel | public static void setWarnLevel()(Code) | | |
|
|