Skip to content

Instantly share code, notes, and snippets.

@estani
estani / TimeElapsedPatternLayout.java
Created March 12, 2017 09:25
Basic Log4j PatternLayout with elapsed time extension using joda time
package com.stackoverflow;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.spi.LoggingEvent;
import org.joda.time.Period;
import org.joda.time.format.PeriodFormatter;
import org.joda.time.format.PeriodFormatterBuilder;
import java.lang.management.ManagementFactory;
/**