Home » apache-log4j-1.2.15 » org.apache » log4j » [javadoc | source]
    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    * 
    9    *      http://www.apache.org/licenses/LICENSE-2.0
   10    * 
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */
   17   
   18   package org.apache.log4j;
   19   
   20   import org.apache.log4j.spi.OptionHandler;
   21   import org.apache.log4j.spi.LoggingEvent;
   22   
   23   /**
   24      Extend this abstract class to create your own log layout format.
   25      
   26      @author Ceki Gülcü
   27   
   28   */
   29     
   30   public abstract class Layout implements OptionHandler {
   31   
   32     // Note that the line.separator property can be looked up even by
   33     // applets.
   34     public final static String LINE_SEP = System.getProperty("line.separator");
   35     public final static int LINE_SEP_LEN  = LINE_SEP.length();
   36   
   37   
   38     /**
   39        Implement this method to create your own layout format.
   40     */
   41     abstract
   42     public
   43     String format(LoggingEvent event);
   44   
   45     /**
   46        Returns the content type output by this layout. The base class
   47        returns "text/plain". 
   48     */
   49     public
   50     String getContentType() {
   51       return "text/plain";
   52     }
   53   
   54     /**
   55        Returns the header for the layout format. The base class returns
   56        <code>null</code>.  */
   57     public
   58     String getHeader() {
   59       return null;
   60     }
   61   
   62     /**
   63        Returns the footer for the layout format. The base class returns
   64        <code>null</code>.  */
   65     public
   66     String getFooter() {
   67       return null;
   68     }
   69   
   70   
   71   
   72     /**
   73        If the layout handles the throwable object contained within
   74        {@link LoggingEvent}, then the layout should return
   75        <code>false</code>. Otherwise, if the layout ignores throwable
   76        object, then the layout should return <code>true</code>.
   77   
   78        <p>The {@link SimpleLayout}, {@link TTCCLayout}, {@link
   79        PatternLayout} all return <code>true</code>. The {@link
   80        org.apache.log4j.xml.XMLLayout} returns <code>false</code>.
   81   
   82        @since 0.8.4 */
   83     abstract
   84     public
   85     boolean ignoresThrowable();
   86   
   87   }

Save This Page
Home » apache-log4j-1.2.15 » org.apache » log4j » [javadoc | source]