Skip to content

io microsphere logging LoggerFactory

github-actions[bot] edited this page Mar 21, 2026 · 1 revision

LoggerFactory

Type: Class | Module: microsphere-java-core | Package: io.microsphere.logging | Since: 1.0.0

Source: microsphere-java-core/src/main/java/io/microsphere/logging/LoggerFactory.java

Overview

The LoggerFactory serves as an abstract base class for creating and managing instances of the Logger type. It also implements the Prioritized interface, allowing subclasses to define priority-based ordering.

Implementations should provide the delegate logger class name and create a new logger instance using the provided name. Subclasses can override the methods to customize the behavior of logger creation and availability checks.

Example Usage

`public class MyLoggerFactory extends LoggerFactory {
    private final String delegateLoggerClassName = "com.example.Logger";

    public MyLoggerFactory() {
        // Set appropriate priority if needed
    `

    protected String getDelegateLoggerClassName() {
        return delegateLoggerClassName;
    }

    public Logger createLogger(String name) {
        return new MyLogger(name);
    }
}
}

Declaration

public abstract class LoggerFactory implements Prioritized

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.1.10-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 8 ✅ Compatible
Java 11 ✅ Compatible
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

public class MyLoggerFactory extends LoggerFactory {
    private final String delegateLoggerClassName = "com.example.Logger";

    public MyLoggerFactory() {
        // Set appropriate priority if needed
    }

    protected String getDelegateLoggerClassName() {
        return delegateLoggerClassName;
    }

    public Logger createLogger(String name) {
        return new MyLogger(name);
    }
}

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-java-core</artifactId>
    <version>${microsphere-java.version}</version>
</dependency>

Tip: Use the BOM (microsphere-java-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.logging.LoggerFactory;

API Reference

Public Methods

Method Description
getLogger Get an instance of Logger by type
getLogger Get an instance of Logger by name

See Also

  • Logger
  • Prioritized

This documentation was auto-generated from the source code of microsphere-java.

Home

java-annotations

java-core

jdk-tools

lang-model

annotation-processor

java-test

Clone this wiki locally