quarkusio/quarkus · error · IllegalStateException

Unable to derive the logger name at ${injectionPoint}

Error message

Unable to derive the logger name at ${injectionPoint}

What it means

LoggerProducer throws this IllegalStateException when a @Logger injection point has no @LoggerName qualifier (or its value is empty), so the producer cannot derive the logger name. The producer must know a name to create the JBoss Logging Logger. The injection point itself is included in the message to help locate the offending field.

Source

Thrown at extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/LoggerProducer.java:42

    @Produces
    @DefaultBean
    Logger getSimpleLogger(InjectionPoint injectionPoint) {
        return loggers.computeIfAbsent(injectionPoint.getMember().getDeclaringClass().getName(), Logger::getLogger);
    }

    @LoggerName("")
    @Dependent
    @Produces
    @DefaultBean
    Logger getLoggerWithCustomName(InjectionPoint injectionPoint) {
        String name = null;
        for (Annotation qualifier : injectionPoint.getQualifiers()) {
            if (qualifier.annotationType().equals(LoggerName.class)) {
                name = ((LoggerName) qualifier).value();
            }
        }
        if (name == null || name.isEmpty()) {
            throw new IllegalStateException("Unable to derive the logger name at " + injectionPoint);
        }
        return loggers.computeIfAbsent(name, Logger::getLogger);
    }

    @PreDestroy
    void destroy() {
        loggers.clear();
    }

}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add @LoggerName("your.logger.name") to the Logger injection point
  2. If you want a class-derived name, inject via a producer/qualification mechanism that derives the name from the injection point class (e.g. LoggerProducer without custom-name requirement)
  3. Rebuild and confirm only one producer method applies to your injection point

Example fix

// before
@Inject
Logger log;
// after
@Inject
@LoggerName("com.example.MyService")
Logger log;
Defensive patterns

Strategy: validation

Validate before calling

LoggerField f = ...;
boolean hasLoggerName = f.getAnnotationsByType(LoggerName.class).length > 0
        && !f.getAnnotation(LoggerName.class).value().isBlank();
if (!hasLoggerName) throw new DeploymentException("Logger injection point needs @LoggerName: " + f);

Try / catch

try {
    Logger log = producer.getLoggerWithCustomName(ip);
} catch (IllegalStateException e) {
    logger.error("Add @LoggerName to the injection point", e);
}

Prevention

When it happens

Trigger: Injecting a Logger without a @LoggerName("...") qualifier while only the name-derived producer is active, or using @LoggerName("") / @LoggerName with a blank value at an injection point.

Common situations: Migrating code that previously used a default logger producer (e.g. named after the class) into a configuration requiring explicit @LoggerName; copy-paste removing the qualifier; typos leaving the qualifier value empty.

Related errors


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