JAL-3949 An attempt at converting to Log4j 2 -- no output achieved!
[jalview.git] / src / jalview / javascript / log4j / Layout.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.javascript.log4j;
22
23 import org.apache.logging.log4j.core.layout.PatternLayout;
24
25 import jalview.javascript.log4j.spi.LoggingEvent;
26 import jalview.javascript.log4j.spi.OptionHandler;
27 //import org.apache.log4j.TTCCLayout;
28
29 public abstract class Layout implements OptionHandler
30 {
31
32   // Note that the line.separator property can be looked up even by
33   // applets.
34   public final static String LINE_SEP = System
35           .getProperty("line.separator");
36
37   public final static int LINE_SEP_LEN = LINE_SEP.length();
38
39   /**
40    * Implement this method to create your own layout format.
41    */
42   abstract public String format(LoggingEvent event);
43
44   /**
45    * Returns the content type output by this layout. The base class returns
46    * "text/plain".
47    */
48   public String getContentType()
49   {
50     return "text/plain";
51   }
52
53   /**
54    * Returns the header for the layout format. The base class returns
55    * <code>null</code>.
56    */
57   public String getHeader()
58   {
59     return null;
60   }
61
62   /**
63    * Returns the footer for the layout format. The base class returns
64    * <code>null</code>.
65    */
66   public String getFooter()
67   {
68     return null;
69   }
70
71   /**
72    * If the layout handles the throwable object contained within
73    * {@link LoggingEvent}, then the layout should return <code>false</code>.
74    * Otherwise, if the layout ignores throwable object, then the layout should
75    * return <code>true</code>. If ignoresThrowable is true, the appender is
76    * responsible for rendering the throwable.
77    * <p>
78    * The {@link SimpleLayout}, {@link TTCCLayout}, {@link PatternLayout} all
79    * return <code>true</code>. The {@link org.apache.log4j.xml.XMLLayout}
80    * returns <code>false</code>.
81    * 
82    * @since 0.8.4
83    */
84   abstract public boolean ignoresThrowable();
85
86 }