Issue
This is the demo class I've created to test log4j properties
Please help me to understand why i'm unable to run the Log4j class
Console outut
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: org.apache.logging.log4j.core.config.ConfigurationException: No type attribute provided for Appender console
at org.apache.logging.log4j.core.config.properties.PropertiesConfigurationBuilder.createAppender(PropertiesConfigurationBuilder.java:216)
at org.apache.logging.log4j.core.config.properties.PropertiesConfigurationBuilder.build(PropertiesConfigurationBuilder.java:151)
at org.apache.logging.log4j.core.config.properties.PropertiesConfigurationFactory.getConfiguration(PropertiesConfigurationFactory.java:56)
at org.apache.logging.log4j.core.config.properties.PropertiesConfigurationFactory.getConfiguration(PropertiesConfigurationFactory.java:35)
at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:558)
at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:482)
at org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:322)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:696)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:717)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:272)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:599)
at utilities.Log4j.<clinit>(Log4j.java:8)
Solution
Looks like you are missing;
appender.console.type = Console
See example here: https://logging.apache.org/log4j/2.x/manual/configuration.html
Answered By - Erion Omeri