Jenkins : custom log formatter for hpi-run

If you don't like the log format used by hpi:run use this approach:

  • Give the name of a logging properties file on the command line
    mvn hpi:run
  • Have your custom formatter listed in the file
    handlers = java.util.logging.ConsoleHandler
    java.util.logging.ConsoleHandler.level = ALL
    java.util.logging.ConsoleHandler.formatter = org.example.SingleLineFormatter

(warning) This is the important step: Add your custom formatter class to the plexus-classworlds*.jar of your Maven installation!

Example Formatter

package org.example;

import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

public class SingleLineFormatter extends Formatter{
    public String format(LogRecord record) {
        return String.format("%1$tY%1$tm%1$td-%1$tH%1$tM%1$tS %2$s %3$s: %4$s\n",