
Maven dependencies are magic. Are you running Maven Java Project and using log4j into your project? Have you added below to your project’s pom.xml file? Probably the easiest way to get logging into your java application is with log4j from Apache.
<dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>2.16.0</version> </dependency>
Well you have to add log4j2.xml file to your project’s resource folder in order for log4j to run correctly with your project.
Update Log4j to latest version
CVE-2021-44228: Apache Log4j2 <=2.14.1 JNDI features used in configuration, log messages, and parameters do not protect against attacker controlled LDAP and other JNDI related endpoints.
From log4j 2.16.0, this behavior has been disabled by default.
Another must read
: How to configure log4j.properties correctly – log4j Sample Program
I recently got below error while running program.

Well, a solution is simple
Add below log4j2.xml
simple configuration file under src/main/resources
folder.
<?xml version="1.0" encoding="UTF-8"?> <Configuration status="WARN"> <!-- Author: Crunchify.com --> <Appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n" /> </Console> <RollingFile name="RollingFile" filename="log/CrunchifyTest.log" filepattern="${logPath}/%d{YYYYMMddHHmmss}-fargo.log"> <PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n" /> <Policies> <SizeBasedTriggeringPolicy size="100 MB" /> </Policies> <DefaultRolloverStrategy max="20" /> </RollingFile> </Appenders> <Loggers> <Root level="info"> <AppenderRef ref="Console" /> <AppenderRef ref="RollingFile" /> </Root> </Loggers> </Configuration>
Try running your program again and you shouldn’t see this issue anymore. Hope this helps.