我正在使用log4j 1.2
配置xml
。我有一个名为EVENT
的自定义级别。如何禁用此级别的日志?
public class STSLevel extends Level
{
static final long serialVersionUID = 3491141966387921975L;
public static final int EVENT_INT = 90000;
public static final Level EVENT = new STSLevel(90000, "EVENT", 0);
protected STSLevel(int arg0, String arg1, int arg2)
{
super(arg0, arg1, arg2);
}
public static Level toLevel(String sArg)
{
if ((sArg != null) && (sArg.toUpperCase().equals("EVENT"))) {
return EVENT;
}
return toLevel(sArg, Level.DEBUG);
}
public static Level toLevel(int val)
{
if (val == 90000) {
return EVENT;
}
return toLevel(val, Level.DEBUG);
}
public static Level toLevel(int val, Level defaultLevel)
{
if (val == 90000) {
return EVENT;
}
return Level.toLevel(val, defaultLevel);
}
public static Level toLevel(String sArg, Level defaultLevel)
{
if ((sArg != null) && (sArg.toUpperCase().equals("EVENT"))) {
return EVENT;
}
return Level.toLevel(sArg, defaultLevel);
}
}
提前致谢