1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
package ...
import org.apache.log4j.Level;
import org.apache.log4j.Priority;
/**
* @author nicgando.Created on 30 mai 2005 <br>
* All org.apache.log4j.Level method are overwritten to use the
* LogFactor5 appender in a remote way. Otherwise get an: log4j:WARN
* Level deserialization failed, reverting to default;
* java.lang.NoSuchMethodException:
*/
public class EnhancedLevel extends Level {
/**
* The always level
*/
public static final EnhancedLevel ALWAYS = new EnhancedLevel ();
private static final String desc = "ALWAYS";
private static final int lvl = Priority.ERROR_INT + 1;
private EnhancedLevel () {
this(lvl, desc, lvl);
}
protected EnhancedLevel (int arg0, String arg1, int arg2) {
super(arg0, arg1, arg2);
}
public static Level toLevel(int val) {
return EnhancedLevel.toLevel(val, DEBUG);
}
public static Level toLevel(int val, Level defaultLevel) {
if (val == lvl)
return ALWAYS;
return Level.toLevel(val, defaultLevel);
}
public static Level toLevel(String sArg) {
return EnhancedLevel.toLevel(sArg, DEBUG);
}
public static Level toLevel(String sArg, Level defaultLevel) {
if (sArg == null)
return defaultLevel;
if (sArg.equalsIgnoreCase(desc))
return ALWAYS;
return Level.toLevel(sArg, defaultLevel);
}
} |
Partager