I would split them up and use a marker: logger.warn(sqlWarning.getMessage()); logger.warn(SQL_WARN_EX, sqlWarning);
Then use a marker filter in configuration to exclude the stack traces with the marker. Sent from my iPhone > On 27 Oct 2016, at 2:41, Gary Gregory <garydgreg...@gmail.com> wrote: > > I have the following use cases that I am pondering on how to best handle: > > I log exceptions like a JDBC SQLWarning (a subclass of Exception): > > logger.warn(sqlWarning.getMessage(). sqlWarning); > > and I want to be able to tell users: "do this to hide this stack trace but > you'll still see the message, note that all other exception are logged > normally". > > How would you do that? > > Invent: > %exception{skipStackTrace=java.sql.SQLWarning} > or > %exception{messageOnly=java.sql.SQLWarning} > > Thoughts? > > Gary > > -- > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org > Java Persistence with Hibernate, Second Edition > JUnit in Action, Second Edition > Spring Batch in Action > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory