LOG4J is the best log component on the Java platform, and log4j 2 upgrades a lot of APIs to make it more scalable. The use of words only need to be introduced directly on it.
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>Then configure the log4j configuration file, the configuration file online Balabala a lot of it.
Then test the following:
@Test public
void Test () {
Logger Logger = Logmanager.getlogger ("HelloWorld");
Logger.info ("I am info info");
Logger.warn ("I am warn Information");
Logger.error ("I am the error message");
Logger.fatal ("I am fatal Information");
}
The console is output like this:
is a color, seemingly no luan use AH. If it is eclipse, it will probably show different colors on the console, but IntelliJ Idea's console does not support ASCII color. However, it can be implemented through a console color plug-in grep console. Idea installation plug-ins are all the same.
After installation, test again; the wind is like this, color can change their own