001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/framework/log/ILogger.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003    
004     This file is part of deegree.
005     Copyright (C) 2001-2008 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: apoth $
058     * 
059     * @version $Revision: 9347 $, $Date: 2007-12-27 17:58:50 +0100 (Do, 27 Dez 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    
101        /**
102         * Logs the given text to the specified file if log level is set to <code>LOG_DEBUG</code>.
103         * 
104         * @param file
105         *            file to log to
106         * @param content
107         *            text to be logged
108         */
109        void logDebugFile( File file, String content );
110    
111        /**
112         * Logs the given text to a temporary file (created from specified prefix and suffix) if log level is set to
113         * <code>LOG_DEBUG</code>.
114         * 
115         * @see File#createTempFile(String, String)
116         * @param filePrefix
117         *            prefix for the temp file name
118         * @param fileSuffix
119         *            suffix for the temp file name, can be null (then ".tmp" is used)
120         * @param content
121         *            text to be logged
122         */
123        void logDebugFile( String filePrefix, String fileSuffix, String content );
124    
125        /**
126         * Logs the given {@link XMLFragment} to a temporary file (created from specified prefix and suffix ".xml") if log
127         * level is set to <code>LOG_DEBUG</code>.
128         * 
129         * @param filePrefix
130         *            prefix for the temp file name
131         * @param fragment
132         *            XMLFragment to be logged (will be pretty-printed)
133         */
134        void logDebugXMLFile( String filePrefix, XMLFragment fragment );
135    
136        /**
137         * Logs the given binary data to the specified file if log level is set to <code>LOG_DEBUG</code>.
138         * 
139         * @param file
140         *            file to log to
141         * @param data
142         *            binary data to be logged
143         */
144        void logDebugBinaryFile( File file, byte[] data );
145    
146        /**
147         * Logs the given binary data to a temporary file (created from specified prefix and suffix) if log level is set to
148         * <code>LOG_DEBUG</code>.
149         * 
150         * @see File#createTempFile(String, String)
151         * @param filePrefix
152         *            prefix for the temp file name
153         * @param fileSuffix
154         *            suffix for the temp file name, can be null (then ".tmp" is used)
155         * @param data
156         *            binary data to be logged
157         */
158        void logDebugBinaryFile( String filePrefix, String fileSuffix, byte[] data );    
159        
160        /**
161         * 
162         * @param message
163         */
164        void logInfo( String message );
165    
166        /**
167         * 
168         * @param message
169         */
170        void logWarning( String message );
171    
172        /**
173         * Log error message.
174         * 
175         * @param message
176         *            the log message
177         */
178        void logError( String message );
179    
180        /**
181         * 
182         * @param message
183         * @param e
184         */
185        void logDebug( String message, Throwable e );
186    
187        /**
188         * 
189         * @param message
190         * @param e
191         */
192        void logInfo( String message, Throwable e );
193    
194        /**
195         * 
196         * @param message
197         * @param e
198         */
199        void logWarning( String message, Throwable e );
200    
201        /**
202         * Log error with exception
203         * 
204         * @param message
205         *            the log message
206         * @param e
207         *            the exception to be logged
208         */
209        void logError( String message, Throwable e );
210    
211        /**
212         * 
213         * @param message
214         * @param tracableObject
215         */
216        void logDebug( String message, Object tracableObject );
217    
218        
219        /**
220         * 
221         * @param message
222         * @param tracableObjects
223         */
224        void logDebug( String message, Object...tracableObject );
225    
226        /**
227         * 
228         * @param message
229         * @param tracableObject
230         */
231        void logInfo( String message, Object tracableObject );
232        
233        /**
234         * 
235         * @param message
236         * @param tracableObjects
237         */
238        void logInfo( String message, Object...tracableObject );
239    
240        /**
241         * 
242         * @param priority
243         * @param message
244         * @param ex
245         */
246        void log( int priority, String message, Throwable ex );
247    
248        /**
249         * 
250         * @param priority
251         * @param message
252         * @param source
253         * @param ex
254         */
255        void log( int priority, String message, Object source, Throwable ex );
256    
257        /**
258         * sets the debug level
259         * 
260         * @param level
261         * 
262         */
263        void setLevel( int level );
264    
265        /**
266         * @return the debug level
267         * 
268         */
269        int getLevel();
270    
271        /**
272         * Debugging log is enabled.
273         * 
274         * @return <code>true</code> if the log level is DEBUG, otherwise <code>false</code>
275         */
276        boolean isDebug();
277    }