View Javadoc
1 package com.rhi.architecture.logging; 2 3 import org.apache.log4j.Level; 4 import org.apache.log4j.Priority; 5 6 /*** 7 * Extend Level to add Trace 8 * 9 * @author Pete McKinstry 10 * @copyright 2002, McKinstry Consulting, All rights reserved. 11 * 12 * @version 1.0 13 */ 14 public class TraceLevel extends Level { 15 16 /*** 17 * integer corresponding to trace level logging. unique & must be 18 * higher than debug level. 19 */ 20 public static final int TRACE_INT = 800; 21 22 // We assimilate TRACE to DEBUG on Syslog 23 private static final int SYSLOG_TRACE_INT = 7; 24 25 /*** 26 * trace level 27 */ 28 public static final Level TRACE = 29 new TraceLevel(TRACE_INT, "TRACE", SYSLOG_TRACE_INT); 30 31 /*** 32 * level for all debugging turned on. 33 */ 34 public static final Level ALL = new TraceLevel(ALL_INT, "ALL", 9); 35 36 /*** 37 * @param level 38 * @param strLevel 39 * @param syslogEquiv 40 */ 41 protected TraceLevel(int level, String strLevel, int syslogEquiv) { 42 super(level, strLevel, syslogEquiv); 43 } 44 45 /*** 46 * @see org.apache.log4j.Priority#toPriority(java.lang.String) 47 * @param sArg 48 * @deprecated 49 * @return 50 */ 51 public static Priority toPriority(String sArg) { 52 return toPriority(sArg, TraceLevel.TRACE); 53 } 54 55 /*** 56 * @see org.apache.log4j.Priority#toPriority(int) 57 * @param i 58 * @return 59 * @throws IllegalArgumentException 60 */ 61 public static Priority toPriority(int i) 62 throws IllegalArgumentException { 63 return toPriority(i, TraceLevel.TRACE); 64 } 65 66 /*** 67 * @see org.apache.log4j.Priority#toPriority(int, org.apache.log4j.Priority) 68 * @param i 69 * @param priority 70 * @return 71 */ 72 public static Priority toPriority(int i, Priority priority) { 73 Priority p = 74 (i == TRACE_INT) 75 ? TraceLevel.TRACE 76 : Priority.toPriority(i, priority); 77 78 return p; 79 } 80 81 /*** 82 * @see org.apache.log4j.Priority#toPriority(java.lang.String, org.apache.log4j.Priority) 83 * @param sArg 84 * @param priority 85 * @return 86 */ 87 public static Priority toPriority(String sArg, Priority priority) { 88 Priority p = 89 (sArg == null) 90 ? TraceLevel.TRACE 91 : ((sArg.equalsIgnoreCase("TRACE")) 92 ? TraceLevel.TRACE 93 : Priority.toPriority(sArg, priority)); 94 95 return p; 96 } 97 98 /*** 99 * @see org.apache.log4j.Level#toLevel(java.lang.String) 100 * @param s 101 * @return 102 */ 103 public static Level toLevel(String s) { 104 return toLevel(s, TraceLevel.TRACE); 105 } 106 107 /*** 108 * @see org.apache.log4j.Level#toLevel(int) 109 * @param i 110 * @return 111 */ 112 public static Level toLevel(int i) { 113 return toLevel(i, TraceLevel.TRACE); 114 } 115 116 /*** 117 * @see org.apache.log4j.Level#toLevel(int, org.apache.log4j.Level) 118 * @param i 119 * @param level 120 * @return 121 */ 122 public static Level toLevel(int i, Level level) { 123 Level l = 124 (i == TRACE_INT) ? TraceLevel.TRACE : Level.toLevel(i, level); 125 126 return l; 127 } 128 129 /*** 130 * @see org.apache.log4j.Level#toLevel(java.lang.String, org.apache.log4j.Level) 131 * @param s 132 * @param level 133 * @return 134 */ 135 public static Level toLevel(String s, Level level) { 136 Level l = 137 (s == null) 138 ? TraceLevel.TRACE 139 : ((s.equalsIgnoreCase("TRACE")) 140 ? TraceLevel.TRACE 141 : Level.toLevel(s, level)); 142 143 return l; 144 } 145 146 /*** 147 * @see org.apache.log4j.Priority#getAllPossiblePriorities() 148 * @deprecated 149 * @return Priority[] array of all available priorities. 150 */ 151 public static Priority[] getAllPossiblePriorities() { 152 return new Priority[] { 153 Priority.FATAL, 154 Priority.ERROR, 155 Level.WARN, 156 Priority.INFO, 157 Priority.DEBUG, 158 TRACE }; 159 } 160 161 }

This page was automatically generated by Maven