01: /*
02: * Copyright (c) 2006, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: /*
17: * $Id: DefaultEvaluator.java,v 1.2 2003/07/02 22:00:04 luque Exp $
18: *
19: * Copyright (c) 2003. Orange Software S.L. All Rights Reserved.
20: * Authored by Rafael Luque & Ruth Zamorano
21: *
22: * You may study, use, modify, and distribute this software for any
23: * purpose provided that this copyright notice appears in all copies.
24: *
25: * This software is provided WITHOUT WARRANTY either expressed or
26: * implied.
27: *
28: */
29:
30: package org.wso2.esb.logging;
31:
32: import org.apache.log4j.Level;
33: import org.apache.log4j.spi.LoggingEvent;
34: import org.apache.log4j.spi.TriggeringEventEvaluator;
35:
36: /**
37: * <code>DefaultEvaluator</code> implements the single method
38: * <code>TriggeringEventEvaluator</code> interface. This class
39: * allows <code>IMAppender</code> to decide when to perform the
40: * IM message delivery.
41: *
42: * @author Rafael Luque & Ruth Zamorano
43: * @version $Revision: 1.2 $
44: */
45:
46: public class DefaultEvaluator implements TriggeringEventEvaluator {
47:
48: /**
49: * Is this <code>event</code> the e-mail triggering event?
50: * <p/>
51: * <p>This method returns <code>true</code> if the event level
52: * has ERROR level or higher. Otherwise it returns
53: * <code>false</code>.
54: */
55: public boolean isTriggeringEvent(LoggingEvent event) {
56: return event.getLevel().isGreaterOrEqual(Level.TRACE);
57: }
58: }
|