Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

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 -Djava.util.logging.config.file=logging.properties
  • Have your custom formatter listed in the logging.properties 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{
    
    @Override
    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",
                record.getMillis(),
                record.getLevel(), 
                record.getSourceClassName(),
                record.getMessage()
                );
    }
}
  • No labels