Skip to content

Invalid logger usage in ThreadPool #14070

@jflaland

Description

@jflaland

Jetty version(s) 12.1.4

Jetty Environment core

HTTP version Not relevant for this issue

Java version/vendor (use: java -version) openjdk version "25.0.1" 2025-10-21 LTS

OS type/version Windows 11 25H2

Description

There were a lot of invalid logger usages that were fixed in jetty 12.1.4 (see #13883 and #13884). However, I found a function that is still using invalid loggers in class org.eclipse.jetty.util.thread.ThreadPool:

    static boolean reject(Runnable task, Throwable cause)
    {
        Logger log = LoggerFactory.getLogger(ThreadPool.class);
        if (log.isDebugEnabled())
            log.debug("rejected {}", task, cause);
        if (task instanceof Closeable closeable)
        {
            try
            {
                closeable.close();
            }
            catch (Throwable t)
            {
                log.warn("Unable to close rejected job: {}", task, t);
                ExceptionUtil.addSuppressedIfNotAssociated(cause, t);
            }
            return true;
        }
        return false;
    }

Both loggers in this function have only one parameter in the message but two are provided (because the exception counts as a parameter).

It produces this warning when debug logs are enabled:

WARN found 1 argument placeholders, but provided 2 for pattern `rejected {}`

How to reproduce?

  1. Use log4j-slf4j2-impl SLF4J backend
  2. Enable debug logs for org.eclipse.jetty
  3. Not sure exactly how to get into that method. In my application, it seems to happen most of the times when jetty is shutting down.

Metadata

Metadata

Labels

BugFor general bugs on Jetty side

Type

No type

Projects

Status

🏗 In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions