quarkusio/quarkus · error · RuntimeException
Unable to create instance of Logging Filter ''
Error message
Unable to create instance of Logging Filter ''
What it means
LoggingSetupRecorder maps each discovered custom log component name to its filter class by instantiating the class via a LogFilterFactory; any exception during instantiation is wrapped in a RuntimeException "Unable to create instance of Logging Filter '<className>'". It means the configured filter/logger class could not be constructed during logging setup.
Source
Thrown at core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java:310
InitialConfigurator.DELAYED_HANDLER.setAutoFlush(false);
InitialConfigurator.DELAYED_HANDLER.setHandlers(handlers.toArray(LogContextInitializer.NO_HANDLERS));
return shutdownNotifier;
}
private static Map<String, Filter> createNamedFilters(DiscoveredLogComponents discoveredLogComponents) {
if (discoveredLogComponents.getNameToFilterClass().isEmpty()) {
return emptyMap();
}
Map<String, Filter> nameToFilter = new HashMap<>();
LogFilterFactory logFilterFactory = LogFilterFactory.load();
discoveredLogComponents.getNameToFilterClass().forEach(new BiConsumer<>() {
@Override
public void accept(String name, String className) {
try {
nameToFilter.put(name, logFilterFactory.create(className));
} catch (Exception e) {
throw new RuntimeException("Unable to create instance of Logging Filter '" + className + "'", e);
}
}
});
return nameToFilter;
}
/**
* WARNING: this method is part of the recorder but is actually called statically at build time.
* You may not push RuntimeValue's to it.
*/
public static void initializeBuildTimeLogging(
final LogRuntimeConfig config,
final LogBuildTimeConfig buildConfig,
final ConsoleRuntimeConfig consoleConfig,
final Map<String, InheritableLevel> categoryDefaultMinLevels,
final List<LogCleanupFilterElement> additionalLogCleanupFilters,
final LaunchMode launchMode) {
View on GitHub (pinned to e1c734241f)
Solutions
- Fix the configured class name in application.properties so it matches an existing filter class on the classpath
- Ensure the filter class has a public no-arg constructor and does not throw during construction
- Add the module/JAR containing the filter class to the application dependencies
- Check the caused-by exception in the stack trace for the underlying reason
Example fix
// before (application.properties) quarkus.log.filter.myfilter=com.example.OldFilter // after quarkus.log.filter.myfilter=com.example.MyLogFilter
Defensive patterns
Strategy: validation
Validate before calling
// before configuring a filter class, verify it instantiates
Class<?> c = Class.forName("com.example.MyLogFilter");
Object f = c.getDeclaredConstructor().newInstance(); // must not throw Try / catch
try { startLogging(); } catch (RuntimeException e) { if (e.getMessage().startsWith("Unable to create instance of Logging Filter")) log.error("Fix quarkus.log.filter class name/constructor", e.getCause()); else throw e; } Prevention
- Keep filter class names in application.properties in sync with code refactors
- Give custom filters public no-arg constructors
- Keep logging-filter modules on the runtime classpath
When it happens
Trigger: quarkus.log.filter or log component configuration naming a filter class that is missing, has no no-arg constructor, throws in its constructor, or is not visible to the classloader at logging setup time.
Common situations: Typo in filter class name in application.properties; filter class removed/refactored after config was written; filter throwing in constructor due to bad config; class in a module not on the runtime classpath.
Related errors
- Only one handler can be configured with the same name '%s'
- The <clazz.getSimpleName()> class [<instanceClass>] could no
- No OTLP protocol specified. Please check `quarkus.otel.expor
- Unsupported OTLP protocol %s specified. Please check `quarku
- Not a resolver:
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/46001df1b441e79a.
Report an issue: GitHub.