Because IntelliJ idea does not support the display of ASCII color, Grep-console plug-in can solve this problem, the following is the development of Java EE Project, combined with LOG4J configuration multi-color log output function.
Installing the Grep-console plugin
Https://plugins.jetbrains.com/plugin/7125-grep-console Download the latest version
Idea's setup install plugin to select the downloaded zip package and restart it.
Set Grep-console Configure the foreground color of all levels of logs
Configure log4j
Maven config file pom.xml add log4j's Trust
[HTML]
<dependency> <groupId>log4j</groupId> <artifactid& gt;log4j</artifactid> <version>1.2.17</version> </version> </dependency>
In the Resource folder, add the log.4j configuration file log4j.properties and add the following:
[HTML]
### set log levels ### log4j.rootlogger = debug , stdout ### output to console ### log4j.appender.stdout = org.apache.log4j.consoleappender Log4j.appender.stdout.Target = System.out Log4j.appender.stdout.layout = org.apache.log4j.patternlayout log4j.appender.stdout.layout.conversionpattern = %-d{yyyy-mm-dd hh:mm:ss} [ %t:%r ] - [ %p ] %m%n ### output to log file ### log4j.appender.d = org.apache.log4j.dailyrollingfileappender log4j.appender.d.file = logs/log.log log4j.appender.d.append = true log4j.appender.d.threshold = debug ## output DEBUG level above log Log4j.appender.d.layout = org.apache.log4j.patternlayout log4j.appender.d.layout.conversionpattern = %-d{yyyy-mm-dd hh:mm:ss} [ %t:%r ] - [ %p ] %m%n d.layout.conversionpattern = %-d{yyyy-mm-dd hh:mm:ss} [ %t:%r ] - [ %p ] %m%n
test the final effectApply JUnit to write the following test code[Java]
@Test public void Testloger () {final Logger Logger = Logger.getlogger ("Testerrout"); Logger.debug ("This is DEBUG!!!"); &nb