Log4j Sets different levels of different packages in profiles

xiaoxiao2021-03-06  92

Log4j Sets different levels of different packages in profiles

The previous while touched the log4j, studied some, and it was quite good.

During this time, due to the use of different bags, different packages need different levels.

I just want to write this in the configuration file:

Log4j.rootlogger = error, rcom.teest.hao2k = debugnet.sf.hibernate.example.quickStart = debug

Then add the debug statement, execute, and the result is not output in the file in the COM.TEST.HAO2K package.

Depressed, did the Log4j's inheritance is invalid

Later, I found the Log4J's API and found the following description:

For non-root categories the syntax is almost the size: log4j.logger.logger_name = [level | inherited | null], appendername, appendername, ... Suddenly realized Logger can

So modified

Log4j.rootlogger = error, rlog4j.logger.com.teest.hao2k = debuglog4j.logger.net.sf.hibernate.example.quickStart = Debug

Test, everything OK.

转载请注明原文地址:https://www.9cbs.com/read-122810.html

New Post(0)