Log4j 2 configuration with IntelliJ idea Console color __java

Source: Internet
Author: User

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



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.