View Javadoc

1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
4    *
5    * This program and the accompanying materials are dual-licensed under
6    * either the terms of the Eclipse Public License v1.0 as published by
7    * the Eclipse Foundation
8    *
9    *   or (per the licensee's choosing)
10   *
11   * under the terms of the GNU Lesser General Public License version 2.1
12   * as published by the Free Software Foundation.
13   */
14  package ch.qos.logback.classic.pattern;
15  
16  import ch.qos.logback.classic.PatternLayout;
17  import ch.qos.logback.classic.spi.ILoggingEvent;
18  import ch.qos.logback.core.CoreConstants;
19  
20  
21  
22  /**
23   * Always returns an empty string.
24   * <p>
25   * This converter is useful to pretend that the converter chain for
26   * PatternLayout actually handles exceptions, when in fact it does not.
27   * By adding %nopex to the conversion pattern, the user can bypass
28   * the automatic addition of %ex conversion pattern for patterns 
29   * which do not contain a converter handling exceptions.
30   * 
31   * <p>Users can ignore the existence of this converter, unless they
32   * want to suppress the automatic printing of exceptions by 
33   * {@link PatternLayout}.
34   * 
35   * @author Ceki G&uuml;lc&uuml;
36   */
37  public class NopThrowableInformationConverter extends ThrowableHandlingConverter {
38  
39    public String convert(ILoggingEvent event) {
40      return CoreConstants.EMPTY_STRING;
41    }
42   
43  }