[logback-user] Custom appender: no stack traces?

Ceki Gülcü ceki at qos.ch
Tue Mar 8 19:38:34 CET 2011


On 08/03/2011 6:36 PM, Christopher Piggott wrote:
> Hi,
> I wrote a custom appender that just writes to a circular queue:
>
> public class MemoryAppender extends AppenderBase<ILoggingEvent>  {
>     stuff
> }
>
>
> I configure it as follows:
>
>      <appender name="ringLogger" class="com.xxxxxxxx.MemoryAppender">
>          <limit>1000</limit>
>      </appender>
>
> His append NEVER receives stack traces:
>
>      public void add(ILoggingEvent loggingEntry) {
>          boolean hasStackTrace = loggingEntry.getCallerData();  /*
> always false ! */
>      }
>
> Any idea why this would be?  This appender is just about as simple as
> it can get ......
>
> --Chris

Hi Chris,

Caller data *extract* caller data from the current thread. You probably 
want getThrowableProxy() on ILoggingEvent.

Shout here if you run into further problems.

--
Ceki

-- 
QOS.ch, main sponsor of cal10n, logback and slf4j open source projects, 
is looking to hire talented software developers. If interested, please 
email your resume to hr at qos.ch.


More information about the Logback-user mailing list