Attachment 'LevelPatternLayout.java'

Download

   1 /* Creado en 09-mar-2005 */
   2 package fcc.ima.trazado;
   3 
   4 import java.util.StringTokenizer;
   5 
   6 import org.apache.log4j.PatternLayout;
   7 import org.apache.log4j.helpers.PatternParser;
   8 
   9 /**Adds support for new field specifiers.
  10  * For further details see {@link LevelPatternParser}.
  11  * @author dperezcar*/
  12 public class LevelPatternLayout extends PatternLayout {
  13 	String[] stop;
  14 	String[] filter;
  15 
  16 	public LevelPatternLayout() {
  17 	}
  18 	public LevelPatternLayout(String pattern) {
  19 		super(pattern);
  20 	}
  21 	/**@see org.apache.log4j.PatternLayout#createPatternParser(java.lang.String) */
  22 	protected PatternParser createPatternParser(String pattern) {
  23 		return new LevelPatternParser(pattern, stop, filter);
  24 	}
  25 	/**Prefixes in class names that should stop stack tracing output.
  26 	 * It can be useful for stopping stack traces third party code that isn't interesting to us, like a web server.*/
  27 	public void setStopStackTracePackages(String val) {
  28 		StringTokenizer st = new StringTokenizer(val);
  29 		stop = new String[st.countTokens()];
  30 		for (int i = 0; i < stop.length; i++) {
  31 			stop[i] = "\tat "+st.nextToken();
  32 		}
  33 	}
  34 	/**Prefixes in class names that should not be shown in stack tracing output.
  35 	 * They do not stop stack trace output.
  36 	 * It can be useful for filtering stack traces of interpreted languages like Python that aren't meaningful.*/
  37 	public void setFilterStackTrace(String val) {
  38 		StringTokenizer st = new StringTokenizer(val);
  39 		filter = new String[st.countTokens()];
  40 		for (int i = 0; i < filter.length; i++) {
  41 			filter[i] = "\tat "+st.nextToken();
  42 		}
  43 	}
  44 	/**@see org.apache.log4j.PatternLayout#ignoresThrowable() */
  45 	public boolean ignoresThrowable() {
  46 		return false;
  47 	}
  48 }

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.