Log4j:如何禁用自定义日志级别

时间:2013-12-06 10:50:31

标签: java logging log4j

我正在使用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);
    }

}

提前致谢

0 个答案:

没有答案