All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.dropwizard.logging.PrefixedThrowableProxyConverter Maven / Gradle / Ivy

There is a newer version: 5.0.0-alpha.5
Show newest version
package io.dropwizard.logging;

import ch.qos.logback.classic.pattern.ThrowableProxyConverter;
import ch.qos.logback.classic.spi.IThrowableProxy;

import java.util.regex.Pattern;

/**
 * A {@link ThrowableProxyConverter} which prefixes stack traces with {@code !}.
 */
public class PrefixedThrowableProxyConverter extends ThrowableProxyConverter {

    static final Pattern PATTERN = Pattern.compile("^\\t?", Pattern.MULTILINE);
    static final String PREFIX = "! ";

    @Override
    protected String throwableProxyToString(IThrowableProxy tp) {
        return PATTERN.matcher(super.throwableProxyToString(tp)).replaceAll(PREFIX);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy