quarkusio/quarkus · error · IllegalStateException

Unimplemented mode of use of 'io.quarkus.runtime.logging.Log

Error message

Unimplemented mode of use of 'io.quarkus.runtime.logging.LoggingFilter'

What it means

LoggingResourceProcessor.discoverLogComponents throws this IllegalStateException during the build when a @LoggingFilter annotation is placed on a target that is not a class (e.g. a method, field, or parameter). Only classes can be processed as log filter components, so any other annotation target is an unimplemented/unsupported use.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java:361

            ConsoleRuntimeConfig consoleRuntimeConfig = config.getConfigMapping(ConsoleRuntimeConfig.class);

            initializeBuildTimeLogging(logRuntimeConfigInBuild, logBuildTimeConfig, consoleRuntimeConfig,
                    categoryMinLevelDefaults.content, additionalLogCleanupFilters, launchModeBuildItem.getLaunchMode());
            // Build time logging is terminated before the application is started, after dev services are started.
            // When there is no devservices build time logging is still closed at deployment classloader close #closeBuildTimeLogging
        }
        return new LoggingSetupBuildItem();
    }

    private DiscoveredLogComponents discoverLogComponents(IndexView index) {
        Collection<AnnotationInstance> loggingFilterInstances = index.getAnnotations(LOGGING_FILTER);
        DiscoveredLogComponents result = new DiscoveredLogComponents();

        Map<String, String> filtersMap = new HashMap<>();
        for (AnnotationInstance instance : loggingFilterInstances) {
            AnnotationTarget target = instance.target();
            if (target.kind() != AnnotationTarget.Kind.CLASS) {
                throw new IllegalStateException("Unimplemented mode of use of '" + LoggingFilter.class.getName() + "'");
            }
            ClassInfo classInfo = target.asClass();
            boolean isFilterImpl = false;
            ClassInfo currentClassInfo = classInfo;
            while ((currentClassInfo != null) && (!JandexUtil.DOTNAME_OBJECT.equals(currentClassInfo.name()))) {
                boolean hasFilterInterface = false;
                List<DotName> ifaces = currentClassInfo.interfaceNames();
                for (DotName iface : ifaces) {
                    if (FILTER.equals(iface)) {
                        hasFilterInterface = true;
                        break;
                    }
                }
                if (hasFilterInterface) {
                    isFilterImpl = true;
                    break;
                }
                currentClassInfo = index.getClassByName(currentClassInfo.superName());

View on GitHub (pinned to e1c734241f)

Solutions

  1. Move the @LoggingFilter annotation onto a public class that implements java.util.logging.Filter.
  2. Ensure the class has a no-arg constructor and a 'name' attribute set on the annotation.
  3. Rebuild the application after fixing the annotation placement.

Example fix

// before
class MyFilterUtil {
    @LoggingFilter(name = "my-filter")
    boolean isLoggable(LogRecord r) { return false; }
}
// after
@LoggingFilter(name = "my-filter")
public class MyFilter implements java.util.logging.Filter {
    @Override
    public boolean isLoggable(LogRecord record) { return false; }
}
Defensive patterns

Strategy: validation

Validate before calling

Class<?> c = MyClass.class;
if (!c.isAnnotationPresent(LoggingFilter.class)) return;
if (!java.util.logging.Filter.class.isAssignableFrom(c)) {
    throw new IllegalStateException("@LoggingFilter must be on a java.util.logging.Filter implementation: " + c);
}

Type guard

static boolean isValidLoggingFilter(Class<?> c) {
    return c.isAnnotationPresent(LoggingFilter.class)
        && java.util.logging.Filter.class.isAssignableFrom(c);
}

Prevention

When it happens

Trigger: Annotating a method, field, or parameter with @io.quarkus.runtime.logging.LoggingFilter instead of a class implementing java.util.logging.Filter; the build step iterates indexed @LoggingFilter instances and rejects non-CLASS targets.

Common situations: Copy-pasting the annotation onto a filter method rather than a filter class; misunderstanding that @LoggingFilter must decorate a java.util.logging.Filter implementation.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/142bcd599a8b171d. Report an issue: GitHub.