X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjavascript%2Flog4j%2FLayout.java;fp=src%2Fjalview%2Fjavascript%2Flog4j%2FLayout.java;h=ea79e1b5ebea6f19b8a9b1ec05bd6fea8521a6f5;hb=8a43b8353b89a47002ef17c959ed61281fc4d826;hp=0000000000000000000000000000000000000000;hpb=55bfdb07355198ae1a1a8b5e14933b4669113ca6;p=jalview.git diff --git a/src/jalview/javascript/log4j/Layout.java b/src/jalview/javascript/log4j/Layout.java new file mode 100644 index 0000000..ea79e1b --- /dev/null +++ b/src/jalview/javascript/log4j/Layout.java @@ -0,0 +1,86 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ +package jalview.javascript.log4j; + +import jalview.javascript.log4j.spi.LoggingEvent; +import jalview.javascript.log4j.spi.OptionHandler; + +import org.apache.log4j.PatternLayout; +import org.apache.log4j.TTCCLayout; + +public abstract class Layout implements OptionHandler +{ + + // Note that the line.separator property can be looked up even by + // applets. + public final static String LINE_SEP = System + .getProperty("line.separator"); + + public final static int LINE_SEP_LEN = LINE_SEP.length(); + + /** + * Implement this method to create your own layout format. + */ + abstract public String format(LoggingEvent event); + + /** + * Returns the content type output by this layout. The base class returns + * "text/plain". + */ + public String getContentType() + { + return "text/plain"; + } + + /** + * Returns the header for the layout format. The base class returns + * null. + */ + public String getHeader() + { + return null; + } + + /** + * Returns the footer for the layout format. The base class returns + * null. + */ + public String getFooter() + { + return null; + } + + /** + * If the layout handles the throwable object contained within + * {@link LoggingEvent}, then the layout should return false. + * Otherwise, if the layout ignores throwable object, then the layout should + * return true. If ignoresThrowable is true, the appender is + * responsible for rendering the throwable. + *

+ * The {@link SimpleLayout}, {@link TTCCLayout}, {@link PatternLayout} all + * return true. The {@link org.apache.log4j.xml.XMLLayout} + * returns false. + * + * @since 0.8.4 + */ + abstract public boolean ignoresThrowable(); + +}