KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > osgi > framework > log > FrameworkLog


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.osgi.framework.log;
12
13 import java.io.*;
14 import org.osgi.framework.FrameworkEvent;
15
16 /**
17  * The FramworkLog interface. A FrameworkLog implementation is provided by the
18  * FrameworkAdaptor and used by the Framework to log any error messages and
19  * FrameworkEvents of type ERROR. The FrameworkLog may persist the log messages
20  * to the filesystem or allow other ways of accessing the log information.
21  * @since 3.1
22  */

23 public interface FrameworkLog {
24     /**
25      * A service lookup constant (value "performance") indicating an
26      * implementation of the logging service that logs performance events.
27      * Create a filter with this property set to <code>"true"</code> in order to
28      * obtain a performance log.
29      *
30      * @since 3.1
31      */

32     public static final String JavaDoc SERVICE_PERFORMANCE = "performance"; //$NON-NLS-1$
33

34     /**
35      * Logs the information from a FrameworkEvent to the FrameworkLog.
36      * @param frameworkEvent The FrameworkEvent to log.
37      */

38     public void log(FrameworkEvent frameworkEvent);
39
40     /**
41      * Logs the FrameworkLogEntry to the FrameworkLog
42      * @param logEntry The entry to log.
43      */

44     public void log(FrameworkLogEntry logEntry);
45
46     /**
47      * Sets the current Writer used to log messages to the specified
48      * newWriter. If append is set to true then the content
49      * of the current Writer will be appended to the new Writer
50      * if possible.
51      * @param newWriter The Writer to use for logging messages.
52      * @param append Indicates whether the content of the current Writer
53      * used for logging messages should be appended to the end of the new
54      * Writer.
55      */

56     public void setWriter(Writer newWriter, boolean append);
57
58     /**
59      * Sets the current File used to log messages to a FileWriter
60      * using the specified File. If append is set to true then the
61      * content of the current Writer will be appended to the
62      * new File if possible.
63      * @param newFile The File to create a new FileWriter which will be
64      * used for logging messages.
65      * @param append Indicates whether the content of the current Writer
66      * used for logging messages should be appended to the end of the new
67      * File.
68      * @throws IOException if any problem occurs while constructing a
69      * FileWriter from the newFile. If this exception is thrown the
70      * FrameworkLog will not be effected and will continue to use the
71      * current Writer to log messages.
72      */

73     public void setFile(File newFile, boolean append) throws IOException;
74
75     /**
76      * Returns the log File if it is set, otherwise null is returned.
77      * @return the log File if it is set, otherwise null is returned.
78      */

79     public File getFile();
80
81     /**
82      * Sets the console log option. If this is set then all logs will be
83      * logged to System.out as well as the current Writer.
84      * @param consoleLog indicates whether to log to System.out
85      */

86     public void setConsoleLog(boolean consoleLog);
87
88     /**
89      * Closes the FrameworkLog. After the FrameworkLog is closed messages may
90      * no longer be logged to it.
91      */

92     public void close();
93 }
94
Popular Tags