Detailed explanation of the problem that the log cannot be printed in the Maven project

Recently, in the learning Maven project, during the log output process, the output content of logger.info("XXXX") cannot be displayed, and the console will display a warning

Error case

log4j:WARN No appenders could be found for logger (org.apache.shiro.io.ResourceUtils).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

 

Cause Analysis

log4j:WARN No appenders could be found for logger (org.apache.shiro.io.ResourceUtils).

The prompt is that the corresponding logger is not found, one of the reasons is that the log file log4j.properites file is not added to the project

 

Solution

Create log4j.properites in the src/main/resources directory (see https://mp.csdn.net/mdeditor/84980319# for the specific file content )

To solve the log can’t print problem

Guess you like

Origin blog.csdn.net/dgxin_605/article/details/84980643