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