Search code examples
eclipseloggingserverjbosswildfly

how to color the log of Wildfly - Jboss Server console on Eclipse


I am using server Wildfly version 18.0.0 and I want to color the log of my server while starting I am using Eclipse as IDE. just like tomcat server Warn, Info.... How to do that?

Console log of wildfly - Jboss server


Solution

  • Coloring the Wildfly log in the Eclipse console

    1. Install the ANSI Escape in Console plugin from the Eclipse Marketplace : https://marketplace.eclipse.org/content/ansi-escape-console

    2. You may have to set or change the -Dorg.jboss.logmanager.nocolor=true VM argument from Wildfly server launch configuration. To change it you:

      1. Go to the "Servers" tab

      2. Right click on the Wildlfy server

      3. Select Open menu entry

      4. In the displayed Overview tab, section General information, click on Open launch configuration

      5. In the Edit Configuration dialog, edit the VM arguments to change -Dorg.jboss.logmanager.nocolor=true argument to false.

        On Linux you may remove the argument, on Windows you have to set it explicitly to false.

      6. Apply + OK

    About the color mapping

    The default color mapping is as follow:

    • error : red
    • warn : yellow
    • info : clear
    • debug : green

    Which gives the syntax error:red,warn:yellow,info:clear,debug:green .

    The default color mapping is set in the org.jboss.logmanager.formatters.ColorMap class.

    Color mapping sample

    In standalone.xml you may set the mapping like this:

    <formatter name="COLOR-PATTERN">
       <pattern-formatter color-map="error:red,warn:yellow,info:clear,fine:white,finer:green,finest:green" pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
    </formatter>