Skip to content

io microsphere io event LoggingFileChangedListener

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

LoggingFileChangedListener

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

Source: microsphere-java-core/src/main/java/io/microsphere/io/event/LoggingFileChangedListener.java

Overview

A FileChangedListener implementation that logs file change events at the debug level.

This class provides a simple way to monitor and log file system changes using the logging framework. It implements all the abstract methods of the FileChangedListener interface, delegating each event to a common logging method. The logging is performed only if the underlying logger is enabled for the debug level, which helps reduce unnecessary overhead in production environments.

Example Usage

Here's how you can create and register a LoggingFileChangedListener instance:

`FileChangedListener listener = new LoggingFileChangedListener();
fileMonitor.addListener(listener);
`

In this example, any file creation, modification, or deletion events monitored by the fileMonitor will be logged at the debug level by the LoggingFileChangedListener.

Note: This class assumes that the underlying logging framework (e.g., SLF4J, Log4j) is configured properly. If no logging framework is available or configured, logging behavior is undefined.

Declaration

public class LoggingFileChangedListener implements FileChangedListener

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

FileChangedListener listener = new LoggingFileChangedListener();
fileMonitor.addListener(listener);

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.io.event.LoggingFileChangedListener;

API Reference

Public Methods

Method Description
onFileCreated
onFileModified
onFileDeleted

See Also

  • FileChangedListener
  • Logger

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