Package org.eclipse.osgi.framework.log
Interface FrameworkLog
-
public interface FrameworkLog
The FramworkLog interface. A FrameworkLog implementation is provided by the FrameworkAdaptor and used by the Framework to log any error messages and FrameworkEvents of type ERROR. The FrameworkLog may persist the log messages to the filesystem or allow other ways of accessing the log information.- Since:
- 3.1
- Restriction:
- This interface is not intended to be implemented by clients.
-
-
Field Summary
Fields Modifier and Type Field Description static String
SERVICE_PERFORMANCE
A service lookup constant (value "performance") indicating an implementation of the logging service that logs performance events.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes the FrameworkLog.File
getFile()
Returns the log File if it is set, otherwise null is returned.void
log(FrameworkLogEntry logEntry)
Logs the FrameworkLogEntry to the FrameworkLogvoid
log(FrameworkEvent frameworkEvent)
Logs the information from a FrameworkEvent to the FrameworkLog.void
setConsoleLog(boolean consoleLog)
Sets the console log option.void
setFile(File newFile, boolean append)
Sets the current File used to log messages to a FileWriter using the specified File.void
setWriter(Writer newWriter, boolean append)
Sets the current Writer used to log messages to the specified newWriter.
-
-
-
Field Detail
-
SERVICE_PERFORMANCE
static final String SERVICE_PERFORMANCE
A service lookup constant (value "performance") indicating an implementation of the logging service that logs performance events. Create a filter with this property set to"true"
in order to obtain a performance log.- Since:
- 3.1
- See Also:
- Constant Field Values
-
-
Method Detail
-
log
void log(FrameworkEvent frameworkEvent)
Logs the information from a FrameworkEvent to the FrameworkLog.- Parameters:
frameworkEvent
- The FrameworkEvent to log.
-
log
void log(FrameworkLogEntry logEntry)
Logs the FrameworkLogEntry to the FrameworkLog- Parameters:
logEntry
- The entry to log.
-
setWriter
void setWriter(Writer newWriter, boolean append)
Sets the current Writer used to log messages to the specified newWriter. If append is set to true then the content of the current Writer will be appended to the new Writer if possible.- Parameters:
newWriter
- The Writer to use for logging messages.append
- Indicates whether the content of the current Writer used for logging messages should be appended to the end of the new Writer.
-
setFile
void setFile(File newFile, boolean append) throws IOException
Sets the current File used to log messages to a FileWriter using the specified File. If append is set to true then the content of the current Writer will be appended to the new File if possible.- Parameters:
newFile
- The File to create a new FileWriter which will be used for logging messages.append
- Indicates whether the content of the current Writer used for logging messages should be appended to the end of the new File.- Throws:
IOException
- if any problem occurs while constructing a FileWriter from the newFile. If this exception is thrown the FrameworkLog will not be affected and will continue to use the current Writer to log messages.
-
getFile
File getFile()
Returns the log File if it is set, otherwise null is returned.- Returns:
- the log File if it is set, otherwise null is returned.
-
setConsoleLog
void setConsoleLog(boolean consoleLog)
Sets the console log option. If this is set then all logs will be logged to System.out as well as the current Writer.- Parameters:
consoleLog
- indicates whether to log to System.out
-
close
void close()
Closes the FrameworkLog. After the FrameworkLog is closed messages may no longer be logged to it.
-
-