Package io.microsphere.logging
Class Sfl4jLoggerFactory
- java.lang.Object
-
- io.microsphere.logging.LoggerFactory
-
- io.microsphere.logging.Sfl4jLoggerFactory
-
- All Implemented Interfaces:
Prioritized,java.lang.Comparable<Prioritized>
public class Sfl4jLoggerFactory extends LoggerFactory
TheLoggerFactoryimplementation for creating and managing SLF4J-basedLoggerinstances.SLF4J (Simple Logging Facade for Java) is a popular logging abstraction that allows the end-user to plug in their desired logging framework at deployment time. This factory checks for the availability of the SLF4J logging infrastructure and creates corresponding logger instances.
Configuration
This factory has a fixed priority level of
Prioritized.NORMAL_PRIORITY, meaning it will be used if no higher-priority logger factory is available.Example Usage
// Get a logger instance by class Logger logger = LoggerFactory.getLogger(MyClass.class); // Log a message logger.info("This is an info message");- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
LoggerFactory,Logger
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSLF4J_LOGGER_CLASS_NAME-
Fields inherited from interface io.microsphere.lang.Prioritized
COMPARATOR, MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description Sfl4jLoggerFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LoggercreateLogger(java.lang.String name)Create a newLoggerprotected java.lang.StringgetDelegateLoggerClassName()The class name of delegate LoggerintgetPriority()Get the priority-
Methods inherited from class io.microsphere.logging.LoggerFactory
getLogger, getLogger, isAvailable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.microsphere.lang.Prioritized
compareTo
-
-
-
-
Field Detail
-
SLF4J_LOGGER_CLASS_NAME
public static final java.lang.String SLF4J_LOGGER_CLASS_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDelegateLoggerClassName
protected java.lang.String getDelegateLoggerClassName()
Description copied from class:LoggerFactoryThe class name of delegate Logger- Specified by:
getDelegateLoggerClassNamein classLoggerFactory- Returns:
- non-null
-
createLogger
public Logger createLogger(java.lang.String name)
Description copied from class:LoggerFactoryCreate a newLogger- Specified by:
createLoggerin classLoggerFactory- Parameters:
name- the name ofLogger- Returns:
- non-null
-
getPriority
public int getPriority()
Description copied from interface:PrioritizedGet the priority- Returns:
- the default is
minimum one
-
-