KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > util > log4j > AccessPriority


1 package de.webman.util.log4j;
2
3 import org.apache.log4j.*;
4 import org.apache.log4j.helpers.PatternParser;
5 import org.apache.log4j.spi.LoggingEvent;
6
7 /**
8
9   New Priority for the tracing of user input
10  * @see org.apache.log4j.Priority
11  * @author $Author: alex $
12  * @version $Revision: 1.1 $
13 */

14 public class AccessPriority extends Priority
15 {
16     static final int ACCESS_INT = Priority.DEBUG_INT - 1;
17
18     private static final String JavaDoc ACCESS_STR = "ACCESS";
19     
20     public static final AccessPriority ACCESS = new AccessPriority(ACCESS_INT, ACCESS_STR, 7);
21
22     protected AccessPriority(int level, String JavaDoc strLevel, int syslogEquiv)
23     {
24         super(level, strLevel, syslogEquiv);
25     }
26
27
28     public static Priority toPriority(String JavaDoc sArg, Priority defaultValue)
29     {
30         if(sArg == null)
31         {
32             return defaultValue;
33         }
34         String JavaDoc stringVal = sArg.toUpperCase();
35         
36         if(stringVal.equals(ACCESS_STR))
37         {
38             return AccessPriority.ACCESS;
39         }
40         return Priority.toPriority(sArg, defaultValue);
41     }
42
43     public static Priority toPriority(String JavaDoc sArg)
44     {
45         return toPriority(sArg, Priority.DEBUG);
46     }
47
48     public static Priority toPriority(int i) throws IllegalArgumentException JavaDoc
49     {
50         if (i == ACCESS_INT) {
51             return AccessPriority.ACCESS;
52         }
53         return Priority.toPriority(i);
54     }
55 }
56
Popular Tags