|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mazz.i18n.LoggerFactory
public class LoggerFactory
Factory used to create the I18N Logger
objects. Note that if you pass to a method a null
value for a logger's locale (or you call a method where Locale is not specified as an argument), then the
default locale to be used will be determined by the LoggerLocale
object.
To tell this factory what types of loggers to create, set the system property i18nlog.logger-type to one of the following:
log4j is to indicate that Apache Log4J is to be used directly as the underlying logging framework; commons is to indicate the use of Apache Commons Logging and jdk is to indicate that the JDK Logging API is to be used.
If this system property is not set, Apache Log4J will be used directly if it is found in this class's class loader. If that is not found, Apache Commons Logging will be used if it is found in this class's class loader. Otherwise, JDK Logging will be used.
You can programatically set the logger type this factory will use by calling
resetLoggerType(mazz.i18n.LoggerFactory.LoggerType)
.
Logger
,
LoggerLocale
Nested Class Summary | |
---|---|
static class |
LoggerFactory.LoggerType
Enum of the different types of loggers. |
Field Summary | |
---|---|
static java.lang.String |
SYSPROP_LOGGER_TYPE
The system property whose value determines the type of loggers this factory creates. |
Method Summary | |
---|---|
static Logger |
getLogger(java.lang.Class clazz)
Creates a new Logger object using a default resource bundle and the JVM's default locale. |
static Logger |
getLogger(java.lang.Class clazz,
java.util.Locale locale)
Creates a new Logger object using a default resource bundle. |
static Logger |
getLogger(java.lang.Class clazz,
Msg.BundleBaseName basename)
Creates a new Logger object using the JVM's default locale. |
static Logger |
getLogger(java.lang.Class clazz,
Msg.BundleBaseName basename,
java.util.Locale locale)
Creates a new Logger object. |
static Logger |
getLogger(java.lang.String name)
Creates a new Logger object using a default resource bundle and the JVM's default locale. |
static Logger |
getLogger(java.lang.String name,
java.util.Locale locale)
Creates a new Logger object using a default resource bundle. |
static Logger |
getLogger(java.lang.String name,
Msg.BundleBaseName basename)
Creates a new Logger object using the JVM's default locale. |
static Logger |
getLogger(java.lang.String name,
Msg.BundleBaseName basename,
java.util.Locale locale)
Creates a new Logger object. |
static LoggerFactory.LoggerType |
resetLoggerType(LoggerFactory.LoggerType type)
Resets the logger type that this factory will use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SYSPROP_LOGGER_TYPE
Method Detail |
---|
public static Logger getLogger(java.lang.String name, Msg.BundleBaseName basename, java.util.Locale locale)
Logger
object.
name
- the name to give to the logger (this is usually a class name of the object that will be
logging messages)basename
- the base bundle name used to identify the resource bundle to use (may be null
)locale
- the locale of the messages that will be logged (may be null
)
Msg.Msg(Msg.BundleBaseName, Locale)
public static Logger getLogger(java.lang.Class clazz, Msg.BundleBaseName basename, java.util.Locale locale)
Logger
object.
clazz
- the class of the object that will be logging messagesbasename
- the base bundle name used to identify the resource bundle to uselocale
- the locale of the messages that will be logged (used to further identify the resource
bundle)
Msg.Msg(Msg.BundleBaseName, Locale)
public static Logger getLogger(java.lang.String name, Msg.BundleBaseName basename)
Logger
object using the JVM's default locale.
name
- the name to give to the logger (this is usually a class name of the object that will be
logging messages)basename
- the base bundle name used to identify the resource bundle to use
Msg.Msg(Msg.BundleBaseName)
public static Logger getLogger(java.lang.Class clazz, Msg.BundleBaseName basename)
Logger
object using the JVM's default locale.
clazz
- the class of the object that will be logging messagesbasename
- the base bundle name used to identify the resource bundle to use
Msg.Msg(Msg.BundleBaseName)
public static Logger getLogger(java.lang.String name, java.util.Locale locale)
Logger
object using a default resource bundle.
name
- the name to give to the logger (this is usually a class name of the object that will be
logging messages)locale
- the locale of the messages that will be logged (used to further identify the resource bundle)
Msg.Msg(Locale)
public static Logger getLogger(java.lang.Class clazz, java.util.Locale locale)
Logger
object using a default resource bundle.
clazz
- the class of the object that will be logging messageslocale
- the locale of the messages that will be logged (used to further identify the resource bundle)
Msg.Msg(Locale)
public static Logger getLogger(java.lang.String name)
Logger
object using a default resource bundle and the JVM's default locale.
name
- the name to give to the logger (this is usually a class name of the object that will be logging
messages)
Msg.Msg()
public static Logger getLogger(java.lang.Class clazz)
Logger
object using a default resource bundle and the JVM's default locale.
clazz
- the class of the object that will be logging messages
Msg.Msg()
public static LoggerFactory.LoggerType resetLoggerType(LoggerFactory.LoggerType type)
type
is null
, the system
property SYSPROP_LOGGER_TYPE
will be examined to determine what logger type to use (and if that
isn't set, JDK logging will be used unless Apache Log4J or Apache Commons logging is found in the class's
classloader, checked in that order).
type
- the new logger type that will be used when creating loggers; if null
will use
heuristics to guess what logger type to use
null
was passed in and the caller wants to
know what will be used)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |