Package io.microsphere.logging
Class JDKLoggerFactory
- java.lang.Object
-
- io.microsphere.logging.LoggerFactory
-
- io.microsphere.logging.JDKLoggerFactory
-
- All Implemented Interfaces:
Prioritized
,java.lang.Comparable<Prioritized>
public class JDKLoggerFactory extends LoggerFactory
ALoggerFactory
implementation that creates and manages instances of JDK logging (Logger
).This factory provides a concrete implementation for creating JDK-based loggers with the required name. It defines priority-based ordering by implementing the
Prioritized
interface, ensuring proper loading order when multiple logger factories are present.Example Usage
The typical usage involves relying on the static methods provided by the base class:// Get a logger instance associated with a specific class Logger logger = getLogger(MyClass.class); // Get a named logger instance Logger namedLogger = getLogger("com.example.mylogger");
The factory is automatically loaded via the ServiceLoader mechanism if registered properly in the configuration files.
- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
LoggerFactory
,Logger
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
JDK_LOGGER_CLASS_NAME
-
Fields inherited from interface io.microsphere.lang.Prioritized
COMPARATOR, MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description JDKLoggerFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Logger
createLogger(java.lang.String name)
Create a newLogger
protected java.lang.String
getDelegateLoggerClassName()
The class name of delegate Loggerint
getPriority()
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
-
JDK_LOGGER_CLASS_NAME
public static final java.lang.String JDK_LOGGER_CLASS_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDelegateLoggerClassName
protected java.lang.String getDelegateLoggerClassName()
Description copied from class:LoggerFactory
The class name of delegate Logger- Specified by:
getDelegateLoggerClassName
in classLoggerFactory
- Returns:
- non-null
-
createLogger
public Logger createLogger(java.lang.String name)
Description copied from class:LoggerFactory
Create a newLogger
- Specified by:
createLogger
in classLoggerFactory
- Parameters:
name
- the name ofLogger
- Returns:
- non-null
-
getPriority
public int getPriority()
Description copied from interface:Prioritized
Get the priority- Returns:
- the default is
minimum one
-
-