001: package org.apache.ojb.broker.util.logging;
002:
003: /* Copyright 2002-2005 The Apache Software Foundation
004: *
005: * Licensed under the Apache License, Version 2.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: import org.apache.ojb.broker.util.configuration.Configurable;
019: import org.apache.ojb.broker.util.configuration.Configuration;
020: import org.apache.ojb.broker.util.configuration.ConfigurationException;
021:
022: import java.io.Serializable;
023:
024: /**
025: * this interface defines the behaviour of a logging mechanism.
026: * This API corresponds closely to the LOG4J Category Api.
027: * By using this interface OJB remains free from Logger-Implementation
028: * specific code.
029: */
030: public interface Logger extends Serializable, Configurable {
031: static final long serialVersionUID = 1177329037874407180L; /*
032: * OJB loglevel constants. they corespond directly to LOG4J LogLevels.
033: */
034: public final static int DEBUG = 1;
035: public final static int INFO = 2;
036: public final static int WARN = 3;
037: public final static int ERROR = 4;
038: public final static int FATAL = 5;
039:
040: /**
041: * generate a message for loglevel DEBUG
042: * @param pObject the message Object
043: */
044: public void debug(Object pObject);
045:
046: /**
047: * generate a message for loglevel INFO
048: * @param pObject the message Object
049: */
050: public void info(Object pObject);
051:
052: /**
053: * generate a message for loglevel WARN
054: * @param pObject the message Object
055: */
056: public void warn(Object pObject);
057:
058: /**
059: * generate a message for loglevel ERROR
060: * @param pObject the message Object
061: */
062: public void error(Object pObject);
063:
064: /**
065: * generate a message for loglevel FATAL
066: * @param pObject the message Object
067: */
068: public void fatal(Object pObject);
069:
070: public void debug(Object message, Throwable obj);
071:
072: public void info(Object message, Throwable obj);
073:
074: public void warn(Object message, Throwable obj);
075:
076: public void error(Object message, Throwable obj);
077:
078: public void fatal(Object message, Throwable obj);
079:
080: public boolean isEnabledFor(int priority);
081:
082: public boolean isDebugEnabled();
083:
084: /**
085: * returns the name of the logger isntance
086: */
087: public String getName();
088:
089: /**
090: * Exception safe log method.
091: * This method can be used to prevent any exception thrown by obj.toString() implementations.
092: * Log level used : DEBUG
093: * @deprecated The normal logging methods should always be safe with regard to exceptions
094: * that are thrown while accessing the arguments.
095: */
096: public void safeDebug(String message, Object obj);
097:
098: /**
099: * Exception safe log method.
100: * This method can be used to prevent any exception thrown by obj.toString() implementations.
101: * Log level used : DEBUG
102: * @deprecated The normal logging methods should always be safe with regard to exceptions
103: * that are thrown while accessing the arguments.
104: */
105: public void safeDebug(String message, Object obj, Throwable t);
106:
107: /**
108: * Exception safe log method.
109: * This method can be used to prevent any exception thrown by obj.toString() implementations.
110: * Log level used : INFO
111: * @deprecated The normal logging methods should always be safe with regard to exceptions
112: * that are thrown while accessing the arguments.
113: */
114: public void safeInfo(String message, Object obj);
115:
116: /**
117: * Exception safe log method.
118: * This method can be used to prevent any exception thrown by obj.toString() implementations.
119: * Log level used : INFO
120: * @deprecated The normal logging methods should always be safe with regard to exceptions
121: * that are thrown while accessing the arguments.
122: */
123: public void safeInfo(String message, Object obj, Throwable t);
124:
125: /**
126: * Exception safe log method.
127: * This method can be used to prevent any exception thrown by obj.toString() implementations.
128: * Log level used : WARN
129: * @deprecated The normal logging methods should always be safe with regard to exceptions
130: * that are thrown while accessing the arguments.
131: */
132: public void safeWarn(String message, Object obj);
133:
134: /**
135: * Exception safe log method.
136: * This method can be used to prevent any exception thrown by obj.toString() implementations.
137: * Log level used : WARN
138: * @deprecated The normal logging methods should always be safe with regard to exceptions
139: * that are thrown while accessing the arguments.
140: */
141: public void safeWarn(String message, Object obj, Throwable t);
142:
143: /**
144: * Exception safe log method.
145: * This method can be used to prevent any exception thrown by obj.toString() implementations.
146: * Log level used : ERROR
147: * @deprecated The normal logging methods should always be safe with regard to exceptions
148: * that are thrown while accessing the arguments.
149: */
150: public void safeError(String message, Object obj);
151:
152: /**
153: * Exception safe log method.
154: * This method can be used to prevent any exception thrown by obj.toString() implementations.
155: * Log level used : ERROR
156: * @deprecated The normal logging methods should always be safe with regard to exceptions
157: * that are thrown while accessing the arguments.
158: */
159: public void safeError(String message, Object obj, Throwable t);
160:
161: /**
162: * Exception safe log method.
163: * This method can be used to prevent any exception thrown by obj.toString() implementations.
164: * Log level used : FATAL
165: * @deprecated The normal logging methods should always be safe with regard to exceptions
166: * that are thrown while accessing the arguments.
167: */
168: public void safeFatal(String message, Object obj);
169:
170: /**
171: * Exception safe log method.
172: * This method can be used to prevent any exception thrown by obj.toString() implementations.
173: * Log level used : FATAL
174: * @deprecated The normal logging methods should always be safe with regard to exceptions
175: * that are thrown while accessing the arguments.
176: */
177: public void safeFatal(String message, Object obj, Throwable t);
178:
179: /**
180: * Configure this logging. Note that the config object will be an instance
181: * of {@link LoggingConfiguration}.
182: *
183: * @param config The {@link LoggingConfiguration} object
184: * @throws ConfigurationException
185: */
186: void configure(Configuration config) throws ConfigurationException;
187: }
|