Throwable converter to show only my frames
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
gradle/wrapper
src/main/java/com/github/tkawachi/appexception
.gitignore
README.md
build.gradle
build.publish.gradle
gradlew
gradlew.bat
settings.gradle

README.md

appexception-logback

Long stack frames in an exception log bores me. appexception-logback shows only my frames.

Install

Add following to build.sbt if you're using sbt:

libraryDependencies += "com.github.tkawachi" % "appexception-logback" % "0.0.2"

Pattern configuration

Add following to logback.xml under <configuration>:

<conversionRule conversionWord="appEx"
  converterClass="com.github.tkawachi.appexception.AppThrowableProxyConverter" />

Then %appEx can be used to format an exception in <pattern>. Example:

<pattern>%level - %logger - %message%n%appEx{my.pkg1, my.pkg2.MyClass}</pattern>

Only stack frames which full qualified class name starts with my.pkg1 or my.pkg2.MyClass will be logged by this pattern.

A class name pattern can also be defined as a property. It's useful to list many prefixes keeping the pattern readable.

<property name="appClassPrefixes" value="
  my.pkg1,
  my.pkg2.MyClass
  "/>
<pattern>%level - %logger - %message%n%appEx{${appClassPrefixes}}</pattern>