Can the stacktrace in Spring Boot be reduced?

前端 未结 1 436
渐次进展
渐次进展 2021-01-20 09:29

Is it possible to reduce the stacktrace from an exception down to ignore Springs stack?

When a method of mine throws a IllegalArgumentException (as intended) and I l

相关标签:
1条回答
  • 2021-01-20 10:03

    There's a Log4J add-on that can filter the stack trace. With the custom layout on the classpath, you can then configure the elements to filter out in your config:

    <appender name="console" class="org.apache.log4j.ConsoleAppender">
        <layout class="it.openutils.log4j.FilteredPatternLayout">
            <param name="ConversionPattern" value="%-5p  %c %F(%M:%L) %d{dd.MM.yyyy HH:mm:ss}  %m%n" />
            <param name="Filter" value="org.apache.catalina" />
            <param name="Filter" value="org.apache.tomcat" />
            <param name="Filter" value="org.apache.coyote" />
            <param name="Filter" value="org.myapp.web.filters" />
            <param name="Filter" value="com.opensymphony.module.sitemesh.filter" />
            <param name="Filter" value="sun.reflect" />
            <param name="Filter" value="javax.servlet.http" />
        </layout>
    </appender>
    
    0 讨论(0)
提交回复
热议问题