Skip to content

io microsphere logging logback util LoggerUtils

github-actions[bot] edited this page Apr 11, 2026 · 4 revisions

LoggerUtils

Type: Class | Module: microsphere-logback | Package: io.microsphere.logging.logback.util | Since: 1.0.0

Source: microsphere-logback/src/main/java/io/microsphere/logging/logback/util/LoggerUtils.java

Overview

The Utilities class of Logback Logger

Declaration

public abstract class LoggerUtils

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.1.6-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

Usage

Maven Dependency

Add the following dependency to your pom.xml:

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

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

Import

import io.microsphere.logging.logback.util.LoggerUtils;

API Reference

Public Methods

Method Description
getLoggerContext Get the LoggerContext
getLogger Get the Logger by specified name
getLogger Get the Logger by the request class
getLevel Get the Level of Logger by the specified logger name
getLevel Get the Level of Logger
setLoggerLevel Set the Level of Logger by the specified logger name
setLoggerLevel Set the Level of Logger
setLoggerLevel Set the Level of Logger
getLevelString Get the Level String of Logger by the specified logger name
getLevelString Get the Level String of Logger

Method Details

getLevel

public static Level getLevel(@Nonnull String loggerName)

Get the Level of Logger by the specified logger name

setLoggerLevel

public static void setLoggerLevel(String loggerName, String levelName)

Set the Level of Logger by the specified logger name

getLevelString

public static String getLevelString(@Nonnull String loggerName)

Get the Level String of Logger by the specified logger name

See Also

  • Logger

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

Clone this wiki locally