[Solved] Spark Error: ERROR StatusLogger No log4j2 configuration file found

I. introduction

When running Kafka related procedures of spark # project, it was warned that although it did not affect the operation, OCD looked very uncomfortable, so it was cleared immediately.

ERROR StatusLogger No log4j2 configuration file found. 
Using default configuration: logging only errors to the console.

II. Problem-solving

1. Add log4j2.xml

Level can be configured in loggers

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n" />

        <RollingFile name="RollingFile" filename="log/test.log"
            <PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n" />
                <SizeBasedTriggeringPolicy size="10 MB" />
            <DefaultRolloverStrategy max="20" />

        <Root level="info">
            <AppenderRef ref="Console" />
            <AppenderRef ref="RollingFile" />

2. Add location

Add it to the Src/main/Resources folder and execute MVN install

3. Display

Since the level in the file is set to info, you can see many related logs and modify them yourself

Read More: