DEV Community

Michael Gantman
Michael Gantman

Posted on

MgntUtils Stacktrace Filtering in Real-World Use: The Soffa Project

Introduction

This article explores the real-world use of the stacktrace filtering feature in MgntUtils. I am the author and maintainer of the MgntUtils open-source library, and I have written about the library and this particular feature in previous articles. The feature itself is described in detail in Java Stacktrace Filtering Utility.

One of the most frustrating aspects of maintaining an open-source library is trying to track its real-world adoption. Most companies, especially commercial ones, keep their source code in private repositories. As a result, even when they use your library, it is often difficult to know about that usage.

Even when tools allow you to identify projects or organizations that depend on your library, you generally cannot see which specific features they use or how they integrate them into their systems.

Occasionally, however, a project hosted on a public platform such as GitHub provides a rare opportunity to look beyond the dependency declaration and examine the actual implementation.

One such project is Soffa, which uses MgntUtils - and, more specifically, its stacktrace filtering feature. Discovering this project was a lucky break for me as an open-source maintainer.

In this article, I will examine the project's source code to show how the feature was integrated into its logging infrastructure.

About the Soffa Project

Soffa is an open-source Java project associated with LaStartupStation, a Morocco-based organization that promotes collaboration between technology startups and large corporations across Africa, including work involving government agencies. The project is associated with Titus Gahissy, a contributor to its codebase.

Soffa's publicly available source code offers a valuable opportunity to examine how MgntUtils' stacktrace filtering was integrated into a project's logging infrastructure.

Actual Stacktrace Filtering Feature Usage

Let's look at the actual code.

In my previously mentioned article, Java Stacktrace Filtering Utility, I described an integration approach that replaces logging statements such as:

logger.info("Message", e);
Enter fullscreen mode Exit fullscreen mode

with

logger.info("Message" + TextUtils.getStacktrace(e));
Enter fullscreen mode Exit fullscreen mode

However, replacing logging statements throughout an existing commercial codebase can require a massive refactoring effort.

The Soffa project took a different approach: it centralized stacktrace filtering in a shared utility class, so that the filtering logic could be invoked from a common infrastructure layer rather than repeated throughout the codebase.

This functionality is implemented in ErrorUtil.java. The two relevant methods are:

  • public static void setRelevantPackage(String pkg) (line 22)
  • public static String getStacktrace(Throwable e) (line 29)

The getStacktrace method is the single point where the project directly invokes MgntUtils' stacktrace filtering logic:

TextUtils.getStacktrace(e, true, defaultErrorPackage);
Enter fullscreen mode Exit fullscreen mode

This establishes a centralized integration point for stacktrace filtering. Other components do not need to invoke MgntUtils directly; they can delegate to ErrorUtil.getStacktrace() instead.

The next layer of this logging infrastructure is Logger.java. Built on top of ErrorUtil, this class provides the logging interface used by the project. Its error method (line 134) relies on the shared stacktrace handling functionality.

The resulting architecture separates the filtering implementation from the logging interface: ErrorUtil encapsulates the direct interaction with MgntUtils, while Logger builds on that utility to provide a common logging layer for the rest of the project. In this way, stacktrace filtering becomes part of the project's shared logging infrastructure rather than a responsibility that every application component must implement independently.

History of MgntUtils Usage in Soffa

The Soffa project used MgntUtils over a span of several years. According to Maven Central, the earliest version of MgntUtils that appeared as a dependency in a Soffa project was version 1.5.1.2. This MgntUtils version was released on February 4th 2021. Various versions of Soffa Foundation projects appear in the Maven Central dependents list for MgntUtils 1.5.1.2.
However, the earliest GitHub commit I found that declares the dependency uses MgntUtils version 1.6.0.1. In this commit by Titus Gahissy from March 9, 2022, the file foundation-commons/build.gradle.kts (line 14) declares the dependency as api("com.github.michaelgantman:MgntUtils:1.6.0.1"). The entire file from this commit can be seen here.
Since then, the MgntUtils dependency has been upgraded to newer versions very shortly after each new release.
The latest upgrade was to MgntUtils version 1.7.0.3 In the December 16, 2025 commit by Titus Gahissy (See build.gradle.kts (line 14)).

In summary, the available evidence indicates that the Soffa project used MgntUtils' stacktrace filtering feature from approximately February 2021 through the end of 2025, using versions ranging from 1.5.1.2 to 1.7.0.3.

Latest Developments in Stacktrace Filtering Integration

As shown above, the Soffa project developed its own infrastructure layer to encapsulate stacktrace filtering for centralized use throughout the project. Since then, I have developed an integration approach that significantly simplifies adoption. The feature can be integrated at the logging-infrastructure level as custom functionality for Logback or Log4j2. This allows users to integrate the feature without making changes to application-level logging calls, rather than having to implement a project-specific abstraction like the one used by Soffa. Detailed integration instructions for Spring Boot are available in Zero-Code-Change Stacktrace Filtering for Spring Boot: An Infrastructure-Level Integration article

Top comments (0)