tfmorris opened a new issue, #4248:
URL: https://github.com/apache/logging-log4j2/issues/4248
## Description
We have a custom appender annotated with
```java
@Plugin(name = "IndentingLayout", elementType = Layout.ELEMENT_TYPE,
category = Node.CATEGORY, printObject = true)
```
which has worked fine for years, despite `elementType` being "no longer
recommended", but this suddenly started failing with 2.26.1 with a
NullPointerException when the logging system is initialized. The fix was easy
once we tracked down the problem, but having it at least release noted would be
helpful.
This fix makes the problem go away:
```diff
-@Plugin(name = "IndentingLayout", elementType = Layout.ELEMENT_TYPE,
category = Node.CATEGORY, printObject = true)
+@Plugin(name = "IndentingLayout", category = Node.CATEGORY, printObject =
true)
```
## Configuration
**Version:** 2.26.1
**Operating system:** OS X 14.8.7
**JDK:** OpenJDK 64-Bit Server VM Temurin-25.0.4+7 (build 25.0.4+7-LTS,
mixed mode, sharing)
## Logs
```
2026-08-10T21:42:30.382459Z main ERROR Could not create plugin of type class
org.apache.logging.log4j.core.appender.ConsoleAppender for element Console:
java.lang.NullPointerException: Cannot invoke
"org.apache.logging.log4j.core.config.plugins.util.PluginType.getElementName()"
because "childType" is null
java.lang.NullPointerException: Cannot invoke
"org.apache.logging.log4j.core.config.plugins.util.PluginType.getElementName()"
because "childType" is null
at
org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:50)
at
org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.injectFields(PluginBuilder.java:195)
at
org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:123)
at
org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1215)
at
org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1134)
at
org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1126)
at
org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:734)
at
org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:271)
at
org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:324)
at
org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:697)
at
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:786)
at
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:808)
at
org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:311)
at
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:160)
at
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:48)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:139)
at
org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:138)
at
org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:58)
at
org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
at
org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:32)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:447)
at com.google.refine.Refine.<clinit>(Refine.java:87)
```
## Reproduction
[An isolated test reproducing the test.
JUnit tests similar to the ones in the code base are extremely appreciated.]
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]