Commits
Tarun Sukhani authored a3e8521faa2
fix: silence spurious "auto configuration log4j2" warning on fresh apps (release 1.12.19)
PF-65: every `play start` on a new app emitted a java.util.logging
WARNING shortly after startup:
May 01, 2026 3:04:36 AM play.Logger warn
WARNING: auto configuration log4j2
Harmless (the fallback recovered with a working logger) but log noise
on every fresh app, misleadingly suggesting something went wrong.
Root cause: LoggerInit.access() at Logger.java:700 called
Paths.get(log4jConf.toURI()) directly. For a fresh app with no
conf/log4j2.xml, the framework's bundled default at
play-{VERSION}.jar!/log4j.properties resolves to a jar:-scheme URI,
and Paths.get throws FileSystemNotFoundException because no JAR
filesystem provider is installed by default. The exception was
caught by the broader try/catch in Logger.init(), which swallowed
it and left Logger.log4j null — tripping the
"auto configuration log4j2" warning fallback even though the
reconfigure had succeeded.
Fix: handle non-file URI schemes explicitly. The bundled default is
unambiguously not user-supplied, so access() returns false directly
without touching Paths.get for jar: URIs.
public boolean access() throws URISyntaxException {
URI uri = log4jConf.toURI();
if (!"file".equals(uri.getScheme())) {
return false;
}
return Paths.get(uri).startsWith(Play.applicationPath.toPath());
}
The downstream configuredManually flag (used by Play.java:236, 666 to
decide whether to override application.log level on top of the user's
config) gets the correct value: false for the framework default, true
for a user-supplied file in the app dir, false for any other location.
Regression test in LoggerTest.accessReturnsFalseForBundledJarUriWithoutThrowing
constructs a real LoggerInit, overwrites log4jConf with a jar:-scheme
URL, and asserts access() returns false. Pre-fix this would have
thrown FileSystemNotFoundException.
Verified: ant unittest BUILD SUCCESSFUL — full framework suite green
including the new test.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>