Log4j2 can only be output from console under tomcat7, but there is no log output.

  java, question

My project is based on maven’s web project, and log4j2 is applied. in the main method, console and log output can be tested, but in the project, only console output is available, and no log record is available. I hope god can give me some advice.

Standalone is slightly different from the web.

Or did the subject just forget to add log4j-web?

<dependencies>
 <dependency>
 <groupId>org.apache.logging.log4j</groupId>
 <artifactId>log4j-web</artifactId>
 <version>2.1</version>
 <scope>runtime</scope>
 </dependency>
 </dependencies>

Referenceshttp://logging.apache.org/log4j/2.x/manual/webapp.html