View Javadoc

1   /**
2    * Logback: the generic, reliable, fast and flexible logging framework.
3    * 
4    * Copyright (C) 2000-2009, QOS.ch
5    * 
6    * This library is free software, you can redistribute it and/or modify it under
7    * the terms of the GNU Lesser General Public License as published by the Free
8    * Software Foundation.
9    */
10  package chapter11;
11  
12  import org.apache.log4j.Layout;
13  import org.apache.log4j.spi.LoggingEvent;
14  
15  
16  /**
17   * 
18   * A very simple log4j layout which formats a logging event
19   * by returning the message contained therein.
20   * 
21   * @author Ceki Gülcü
22   *
23   */
24  public class TrivialLog4jLayout extends Layout {
25  
26    public void activateOptions() {
27      // there are no options to activate
28    }
29  
30    public String format(LoggingEvent loggingEvent) {
31      return loggingEvent.getRenderedMessage();
32    }
33  
34    @Override
35    public boolean ignoresThrowable() {
36      return true;
37    }
38  
39  }