While I was installing a Java application that uses Log4j (via Spring Boot Logging), I was told that I could configure the logging level for all packages used in the application by including the following line in the application.properties
file:
logging.level.*=ERROR
Where ERROR
could be whatever logging level I wanted to use.
However, as I changed the level from one value to another, no matter what value I used, I found that log messages down to DEBUG
would appear in the log.
Eventually, I found that using specific package names I could control the minimum level to be logged. That is, logging.level.org.orgname.appname=ERROR
would do what I wanted.
Are the log level properties meant to to support wildcards like "*"?
Since my question seems unpopular, but I've found an answer anyway, I'll post it for completeness.
Neither Log4j nor Spring Boot Logging support wildcards such as logging.level.*
. There is some documentation that uses that exact phrase, but they mean for the reader to substitute a package name for the asterisk. My colleagues didn't understand that and used it verbatim in documentation for their application.
The equivalent in Spring Boot Logging is logging.level.root
. The equivalent in Log4j configuration files is log4j.rootLogger
, although that requires one or more additional arguments giving the names of log appender objects.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.