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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 package org.apache.log4j;
20 import org.apache.log4j.spi.OptionHandler;
21 import org.apache.log4j.spi.LoggingEvent;
24 Extend this abstract class to create your own log layout format.
26 @author Ceki Gülcü
30 public abstract class Layout implements OptionHandler {
32 // Note that the line.separator property can be looked up even by
34 public final static String LINE_SEP = System.getProperty("line.separator");
35 public final static int LINE_SEP_LEN = LINE_SEP.length();
39 Implement this method to create your own layout format.
43 String format(LoggingEvent event);
46 Returns the content type output by this layout. The base class
50 String getContentType() {
55 Returns the header for the layout format. The base class returns
63 Returns the footer for the layout format. The base class returns
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 If ignoresThrowable is true, the appender is responsible for
78 rendering the throwable.
80 <p>The {@link SimpleLayout}, {@link TTCCLayout}, {@link
81 PatternLayout} all return <code>true</code>. The {@link
82 org.apache.log4j.xml.XMLLayout} returns <code>false</code>.
87 boolean ignoresThrowable();