Mathijs den Burger

Nov 15, 2017

Remove "talledLocalContainer" via LOGBack (and get colors too)

Tired of seeing "talledLocalContainer" in your logging output? Here's how to get rid of it!

 

By default, each line in the logs of your locally running project is prefixed with "[talledLocalContainer]". It's put there by the Cargo plugin. This is the Maven plugin that we use to start the Tomcat container during local development.

Unfortunately, the line cannot be removed via the configuration of that plugin, so you're stuck with this "useless" line many times. Which takes away valuable screen space 😉

 

Say you installed Maven in ~/apache-maven. Then:

 

  1. Copy a recent version of the logback-core en logback-classic jars to ~/apache-maven/lib (get them at Maven central)
  2. Remove ~/apache-maven/lib/slf4j-simple-*.jar
  3. Create ~/apache-maven/conf/logging/logback.xml:

 

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%highlight(%-4level) %replace(%msg){'\[talledLocalContainer\] |\[stalledLocalDeployer\] ',''}%n</pattern>
    </encoder>
  </appender>

  <logger name="org.apache.maven" level="info"/>
  <logger name="org.codehaus" level="info"/>
  <logger name="org.eclipse.aether" level="info"/>
  <logger name="org.elasticsearch" level="info"/>

  <root level="debug">
    <appender-ref ref="STDOUT" />
  </root>
</configuration>

 

The INFO and WARN prefixes of each line will now be coloured, and [talledLocalContainer] and [stalledLocalDeployer] will be removed.

You can, of course, tweak this logback.xml file endlessly. Have a look at the Classic Pattern Layout by LOGBack if you are interested in what's possible. 

 

Credits to Michiel Eggermont for this trick!

Newsletter

Don’t miss the next post!

Join
Don’t miss the next post!