View Javadoc
1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2015, 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   * Always returns an empty string.
22   * <p>
23   * This converter is useful to pretend that the converter chain for
24   * PatternLayout actually handles exceptions, when in fact it does not.
25   * By adding %nopex to the conversion pattern, the user can bypass
26   * the automatic addition of %ex conversion pattern for patterns 
27   * which do not contain a converter handling exceptions.
28   * 
29   * <p>Users can ignore the existence of this converter, unless they
30   * want to suppress the automatic printing of exceptions by 
31   * {@link PatternLayout}.
32   * 
33   * @author Ceki G&uuml;lc&uuml;
34   */
35  public class NopThrowableInformationConverter extends ThrowableHandlingConverter {
36  
37      public String convert(ILoggingEvent event) {
38          return CoreConstants.EMPTY_STRING;
39      }
40  
41  }