Skip to content

io microsphere logging jmx LoggingMXBeanAdapter

github-actions[bot] edited this page May 30, 2026 · 9 revisions

LoggingMXBeanAdapter

Type: Class | Module: microsphere-logging-commons | Package: io.microsphere.logging.jmx | Since: 1.0.0

Source: microsphere-logging-commons/src/main/java/io/microsphere/logging/jmx/LoggingMXBeanAdapter.java

Overview

LoggingMXBean Adapter based on the Logging delegate.

Declaration

public class LoggingMXBeanAdapter implements LoggingMXBean, DelegatingWrapper

Author: Mercy

Version Information

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

Method Examples

getLoggerNames

Logging logging = LoggingUtils.load();
  LoggingMXBeanAdapter adapter = new LoggingMXBeanAdapter(logging);
Logging logging = LoggingUtils.load();
  LoggingMXBeanAdapter adapter = new LoggingMXBeanAdapter(logging);
  List<String> names = adapter.getLoggerNames();

getLoggerLevel

Logging logging = LoggingUtils.load();
  LoggingMXBeanAdapter adapter = new LoggingMXBeanAdapter(logging);
  String level = adapter.getLoggerLevel("io.microsphere");

setLoggerLevel

Logging logging = LoggingUtils.load();
  LoggingMXBeanAdapter adapter = new LoggingMXBeanAdapter(logging);
  adapter.setLoggerLevel("io.microsphere", "DEBUG");

getParentLoggerName

Logging logging = LoggingUtils.load();
  LoggingMXBeanAdapter adapter = new LoggingMXBeanAdapter(logging);
  String parentName = adapter.getParentLoggerName("io.microsphere.logging");
  // returns "io.microsphere"

getDelegate

Logging logging = LoggingUtils.load();
  LoggingMXBeanAdapter adapter = new LoggingMXBeanAdapter(logging);
  Logging delegate = (Logging) adapter.getDelegate();

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-logging-commons</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.jmx.LoggingMXBeanAdapter;

API Reference

Public Methods

Method Description
getLoggerNames Creates a new LoggingMXBeanAdapter wrapping the given Logging instance.
getLoggerLevel {@inheritDoc}
setLoggerLevel {@inheritDoc}
getParentLoggerName {@inheritDoc}
getDelegate Returns the underlying Logging delegate.

Method Details

getLoggerNames

public List<String> getLoggerNames()

Creates a new LoggingMXBeanAdapter wrapping the given Logging instance.

Example Usage

`Logging logging = LoggingUtils.load();
  LoggingMXBeanAdapter adapter = new LoggingMXBeanAdapter(logging);
`

getLoggerLevel

public String getLoggerLevel(String loggerName)

{@inheritDoc}

Example Usage

`Logging logging = LoggingUtils.load();
  LoggingMXBeanAdapter adapter = new LoggingMXBeanAdapter(logging);
  String level = adapter.getLoggerLevel("io.microsphere");
`

setLoggerLevel

public void setLoggerLevel(String loggerName, String levelName)

{@inheritDoc}

Example Usage

`Logging logging = LoggingUtils.load();
  LoggingMXBeanAdapter adapter = new LoggingMXBeanAdapter(logging);
  adapter.setLoggerLevel("io.microsphere", "DEBUG");
`

getParentLoggerName

public String getParentLoggerName(String loggerName)

{@inheritDoc}

Example Usage

`Logging logging = LoggingUtils.load();
  LoggingMXBeanAdapter adapter = new LoggingMXBeanAdapter(logging);
  String parentName = adapter.getParentLoggerName("io.microsphere.logging");
  // returns "io.microsphere"
`

getDelegate

public Object getDelegate()

Returns the underlying Logging delegate.

Example Usage

`Logging logging = LoggingUtils.load();
  LoggingMXBeanAdapter adapter = new LoggingMXBeanAdapter(logging);
  Logging delegate = (Logging) adapter.getDelegate();
`

See Also

  • LoggingMXBean
  • Logging

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

Clone this wiki locally