Tag Archives: Please initialize the log4j system properly

log4j Error: Please initialize the log4j system properly [How to Solve]

pom.xml

<dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.7</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

log4j.properties

 log4j.rootLogger=INFO.console
 log4j.appender.console=org.apache.log4j.ConsoleAppender
 log4j.appender.console.layout=org.apache.log4j.PatternLayout
 log4j.appender.console.layout.ConversionPattern=%d{HH:mm:ss.SSS} %-5p %-60c %X - %m%n

Errors found:

log4j:WARN No appenders could be found for logger (org.apache.flink.streaming.api.graph.StreamGraphGenerator).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

Later, it was found that the configuration was written incorrectly. Just change “log4j. Rootlogger = info. Console” to “log4j. Rootlogger = info, console”