001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/framework/log/ILogger.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003    
004     This file is part of deegree.
005     Copyright (C) 2001-2006 by:
006     EXSE, Department of Geography, University of Bonn
007     http://www.giub.uni-bonn.de/deegree/
008     lat/lon GmbH
009     http://www.lat-lon.de
010    
011     This library is free software; you can redistribute it and/or
012     modify it under the terms of the GNU Lesser General Public
013     License as published by the Free Software Foundation; either
014     version 2.1 of the License, or (at your option) any later version.
015    
016     This library is distributed in the hope that it will be useful,
017     but WITHOUT ANY WARRANTY; without even the implied warranty of
018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019     Lesser General Public License for more details.
020    
021     You should have received a copy of the GNU Lesser General Public
022     License along with this library; if not, write to the Free Software
023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024    
025     Contact:
026    
027     Andreas Poth
028     lat/lon GmbH
029     Aennchenstr. 19
030     53115 Bonn
031     Germany
032     E-Mail: poth@lat-lon.de
033    
034     Prof. Dr. Klaus Greve
035     Department of Geography
036     University of Bonn
037     Meckenheimer Allee 166
038     53115 Bonn
039     Germany
040     E-Mail: greve@giub.uni-bonn.de
041    
042     
043     ---------------------------------------------------------------------------*/
044    package org.deegree.framework.log;
045    
046    import java.io.File;
047    import java.util.Properties;
048    
049    import org.deegree.framework.xml.XMLFragment;
050    
051    /**
052     * This interface specifies the log worker services.
053     * 
054     * @author <a href="mailto:tfr@users.sourceforge.net">Torsten Friebe</a>
055     * @author <a href="mailto:schmitz@lat-lon.de">Andreas Schmitz</a>
056     * @author <a href="mailto:schneider@lat-lon.de">Markus Schneider</a>
057     * @author last edited by: $Author: mschneider $
058     * 
059     * @version $Revision: 7597 $, $Date: 2007-06-19 15:29:49 +0200 (Di, 19 Jun 2007) $
060     */
061    public interface ILogger {
062    
063        /** Debug log level */
064        int LOG_DEBUG = 0;
065    
066        /** Info log level */
067        int LOG_INFO = 1;
068    
069        /** Warning log level */
070        int LOG_WARNING = 2;
071    
072        /** Fatal error log level */
073        int LOG_ERROR = 3;
074    
075        /**
076         * 
077         * @param props
078         */
079        void init( Properties props );
080    
081        /**
082         * 
083         * @param name
084         */
085        void bindClass( String name );
086    
087        /**
088         * 
089         * @param name
090         */
091        void bindClass( Class name );
092    
093        /**
094         * 
095         * @param message
096         */
097        void logDebug( String message );
098    
099        /**
100         * Logs the given text to the specified file if log level is set to <code>LOG_DEBUG</code>.
101         * 
102         * @param file
103         *            file to log to
104         * @param content
105         *            text to be logged
106         */
107        void logDebugFile( File file, String content );
108    
109        /**
110         * Logs the given text to a temporary file (created from specified prefix and suffix) if log level is set to
111         * <code>LOG_DEBUG</code>.
112         * 
113         * @see File#createTempFile(String, String)
114         * @param filePrefix
115         *            prefix for the temp file name
116         * @param fileSuffix
117         *            suffix for the temp file name, can be null (then ".tmp" is used)
118         * @param content
119         *            text to be logged
120         */
121        void logDebugFile( String filePrefix, String fileSuffix, String content );
122    
123        /**
124         * Logs the given {@link XMLFragment} to a temporary file (created from specified prefix and suffix ".xml") if log
125         * level is set to <code>LOG_DEBUG</code>.
126         * 
127         * @param filePrefix
128         *            prefix for the temp file name
129         * @param fragment
130         *            XMLFragment to be logged (will be pretty-printed)
131         */
132        void logDebugXMLFile( String filePrefix, XMLFragment fragment );
133    
134        /**
135         * Logs the given binary data to the specified file if log level is set to <code>LOG_DEBUG</code>.
136         * 
137         * @param file
138         *            file to log to
139         * @param data
140         *            binary data to be logged
141         */
142        void logDebugBinaryFile( File file, byte[] data );
143    
144        /**
145         * Logs the given binary data to a temporary file (created from specified prefix and suffix) if log level is set to
146         * <code>LOG_DEBUG</code>.
147         * 
148         * @see File#createTempFile(String, String)
149         * @param filePrefix
150         *            prefix for the temp file name
151         * @param fileSuffix
152         *            suffix for the temp file name, can be null (then ".tmp" is used)
153         * @param data
154         *            binary data to be logged
155         */
156        void logDebugBinaryFile( String filePrefix, String fileSuffix, byte[] data );    
157        
158        /**
159         * 
160         * @param message
161         */
162        void logInfo( String message );
163    
164        /**
165         * 
166         * @param message
167         */
168        void logWarning( String message );
169    
170        /**
171         * Log error message.
172         * 
173         * @param message
174         *            the log message
175         */
176        void logError( String message );
177    
178        /**
179         * 
180         * @param message
181         * @param e
182         */
183        void logDebug( String message, Throwable e );
184    
185        /**
186         * 
187         * @param message
188         * @param e
189         */
190        void logInfo( String message, Throwable e );
191    
192        /**
193         * 
194         * @param message
195         * @param e
196         */
197        void logWarning( String message, Throwable e );
198    
199        /**
200         * Log error with exception
201         * 
202         * @param message
203         *            the log message
204         * @param e
205         *            the exception to be logged
206         */
207        void logError( String message, Throwable e );
208    
209        /**
210         * 
211         * @param message
212         * @param tracableObject
213         */
214        void logDebug( String message, Object tracableObject );
215    
216        /**
217         * 
218         * @param message
219         * @param tracableObject
220         */
221        void logInfo( String message, Object tracableObject );
222    
223        /**
224         * 
225         * @param priority
226         * @param message
227         * @param ex
228         */
229        void log( int priority, String message, Throwable ex );
230    
231        /**
232         * 
233         * @param priority
234         * @param message
235         * @param source
236         * @param ex
237         */
238        void log( int priority, String message, Object source, Throwable ex );
239    
240        /**
241         * Log a method entry.
242         * 
243         */
244        void entering();
245    
246        /**
247         * Log a method entry.
248         * 
249         * @param sourceClass
250         * @param sourceMethod
251         */
252        void entering( String sourceClass, String sourceMethod );
253    
254        /**
255         * Log a method entry with parameters.
256         * 
257         * @param sourceClass
258         * @param sourceMethod
259         * @param arguments
260         *            the parameters to be given
261         */
262        void entering( String sourceClass, String sourceMethod, Object[] arguments );
263    
264        /**
265         * Log a method return.
266         */
267        void exiting();
268    
269        /**
270         * Log a method return.
271         * 
272         * @param sourceClass
273         * @param sourceMethod
274         */
275        void exiting( String sourceClass, String sourceMethod );
276    
277        /**
278         * Log a method return with parameters.
279         * 
280         * @param sourceClass
281         * @param sourceMethod
282         * @param arguments
283         */
284        void exiting( String sourceClass, String sourceMethod, Object[] arguments );
285    
286        /**
287         * sets the debug level
288         * 
289         * @param level
290         * 
291         */
292        void setLevel( int level );
293    
294        /**
295         * @return the debug level
296         * 
297         */
298        int getLevel();
299    
300        /**
301         * Debugging log is enabled.
302         * 
303         * @return <code>true</code> if the log level is DEBUG, otherwise <code>false</code>
304         */
305        boolean isDebug();
306    }