Warning message is logged only if isDebugEnabled in AbstractLifeCycle. Is it wanted?
- Dominant language
- Java
- Stars
- 4.1k
- Forks
- 2k
- Avg merge
- 3d 56m
- Merged PRs (30d)
- 48
Description
**Jetty version(s)**
For every Jetty 12.x, the AbstractLifeCycle class has this piece of code:
```
private void setFailed(Throwable th)
{
_state = State.FAILED;
if (LOG.isDebugEnabled())
LOG.warn("FAILED {}: {}", this, th, th);
........................
```
Isn't it an incongruence that the Warning message is logged only if isDebugEnabled()?
As an example, if the password of https certificate keystore has an error, in the log there is not the cause of Jetty not starting. Only if the log level is DEBUG the WARN log message is present:
```
......... 11:36:43.729 | WARN | AbstractLifeCycle :main | FAILED oejs.Server@20435c40{FAILED}[12.1.8,sto=5000]: java.io.IOException: Keystore was tampered with, or password was incorrect
java.io.IOException: Keystore was tampered with, or password was incorrect
at java.base/sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:813)
at java.base/sun.security.util.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:242)
at java.base/java.security.KeyStore.load(KeyStore.java:1473)
at org.eclipse.jetty.util.security.CertificateUtils.getKeyStore(CertificateUtils.java:51)
at org.eclipse.jetty.util.ssl.SslContextFactory.loadKeyStore(SslContextFactory.java:1157)
at org.eclipse.jetty.util.ssl.SslContextFactory.load(SslContextFactory.java:301)
at org.eclipse.jetty.util.ssl.SslContextFactory.doStart(SslContextFactory.java:222)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:92)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:170)
at org.eclipse.jetty.server.Server.start(Server.java:689)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:121)
at org.eclipse.jetty.server.Handler$Abstract.doStart(Handler.java:545)
at org.eclipse.jetty.server.Server.doStart(Server.java:630)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:92)
at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:2134)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.jetty.start.Main.invokeMain(Main.java:312)
at org.eclipse.jetty.start.Main.start(Main.java:603)
at org.eclipse.jetty.start.Main.main(Main.java:82)
Caused by: java.security.UnrecoverableKeyException: Password verification failed
at java.base/sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:811)
... 21 common frames omitted
```
**Enhancement Description**
Let the warn message be printed also with a Logger with WARN or INFO level, at least without the stacktrace
Contributor guide
Research direction
Start in AbstractLifeCycle.setFailed(Throwable), where the WARN message is currently guarded by isDebugEnabled(). Inspect the surrounding logging behavior and existing lifecycle tests, then verify that the failure is reported at WARN or INFO as requested, with the stack trace behavior matching the intended change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100