|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.runtime.adaptor.EclipseLog
public class EclipseLog
The FrameworkLog implementation for Eclipse.
Clients may extend this class.
Field Summary | |
---|---|
static java.lang.String |
BACKUP_MARK
The extension markup to use for backup log files |
protected boolean |
consoleLog
Indicates if the console messages should be printed to the console (System.out) |
static int |
DEFAULT_LOG_FILES
The default number of backup log files |
static int |
DEFAULT_LOG_SIZE
The default size a log file can grow before it is rotated |
protected static java.lang.String |
ENTRY
The entry tag |
protected static java.lang.String |
LINE_SEPARATOR
The line separator used in the log output |
static java.lang.String |
LOG_EXT
The extension used for log files |
static int |
LOG_SIZE_MIN
The minimum size limit for log rotation |
protected static java.lang.String |
MESSAGE
The message tag |
protected boolean |
newSession
Indicates if the next log message is part of a new session |
protected java.io.File |
outFile
The File object to store messages. |
static java.lang.String |
PROP_LOG_FILE_MAX
The system property used to specify the maximim number of backup log files to use |
static java.lang.String |
PROP_LOG_SIZE_MAX
The system property used to specify size a log file can grow before it is rotated |
protected static java.lang.String |
SESSION
The session tag |
protected static java.lang.String |
STACK
The stacktrace tag |
protected static java.lang.String |
SUBENTRY
The sub-entry tag |
protected static java.lang.String |
TAB_STRING
The tab character used in the log output |
protected java.io.Writer |
writer
The Writer to log messages to. |
Fields inherited from interface org.eclipse.osgi.framework.log.FrameworkLog |
---|
SERVICE_PERFORMANCE |
Constructor Summary | |
---|---|
EclipseLog()
Constructs an EclipseLog which uses System.err to write log messages to |
|
EclipseLog(java.io.File outFile)
Constructs an EclipseLog which uses the specified File to log messages to |
|
EclipseLog(java.io.Writer writer)
Constructs an EclipseLog which uses the specified Writer to log messages to |
Method Summary | |
---|---|
protected boolean |
checkLogFileSize()
Checks the log file size. |
void |
close()
|
protected void |
closeFile()
If a File is used to log messages to then the writer is closed. |
protected java.lang.String |
getDate(java.util.Date date)
Returns a date string using the correct format for the log. |
java.io.File |
getFile()
|
protected java.lang.String |
getSessionTimestamp()
Returns the session timestamp. |
protected java.lang.String |
getStackTrace(java.lang.Throwable t)
Returns a stacktrace string using the correct format for the log |
void |
log(FrameworkEvent frameworkEvent)
|
void |
log(org.eclipse.osgi.framework.log.FrameworkLogEntry logEntry)
|
protected java.io.Writer |
logForStream(java.io.OutputStream output)
Returns a Writer for the given OutputStream |
protected void |
openFile()
If a File is used to log messages to then the File opened and a Writer is created to log messages to. |
protected void |
readLogProperties()
Reads the PROP_LOG_SIZE_MAX and PROP_LOG_FILE_MAX properties. |
void |
setConsoleLog(boolean consoleLog)
|
void |
setFile(java.io.File newFile,
boolean append)
|
void |
setWriter(java.io.Writer newWriter,
boolean append)
|
protected void |
write(java.lang.String message)
Writes the given message to the log. |
protected void |
writeArgs(java.lang.String header,
java.lang.String[] args)
Helper method for writing out argument arrays. |
protected void |
writeEntry(int depth,
org.eclipse.osgi.framework.log.FrameworkLogEntry entry)
Writes the ENTRY or SUBENTRY header for an entry. |
protected void |
writeln()
Writes a newline log. |
protected void |
writeln(java.lang.String s)
Writes the given message to the log and a newline. |
protected void |
writeLog(int depth,
org.eclipse.osgi.framework.log.FrameworkLogEntry entry)
Writes the log entry to the log using the specified depth. |
protected void |
writeMessage(org.eclipse.osgi.framework.log.FrameworkLogEntry entry)
Writes the MESSAGE header to the log for the given entry. |
protected void |
writeSession()
Writes the session |
protected void |
writeSpace()
Writes a space to the log. |
protected void |
writeStack(org.eclipse.osgi.framework.log.FrameworkLogEntry entry)
Writes the STACK header to the log for the given entry. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String SESSION
protected static final java.lang.String ENTRY
protected static final java.lang.String SUBENTRY
protected static final java.lang.String MESSAGE
protected static final java.lang.String STACK
protected static final java.lang.String LINE_SEPARATOR
protected static final java.lang.String TAB_STRING
public static final int DEFAULT_LOG_SIZE
public static final int DEFAULT_LOG_FILES
public static final int LOG_SIZE_MIN
public static final java.lang.String PROP_LOG_SIZE_MAX
public static final java.lang.String PROP_LOG_FILE_MAX
public static final java.lang.String LOG_EXT
public static final java.lang.String BACKUP_MARK
protected boolean consoleLog
protected boolean newSession
protected java.io.File outFile
protected java.io.Writer writer
Constructor Detail |
---|
public EclipseLog(java.io.File outFile)
outFile
- a file to log messages topublic EclipseLog(java.io.Writer writer)
writer
- a writer to log messages topublic EclipseLog()
Method Detail |
---|
protected void writeArgs(java.lang.String header, java.lang.String[] args) throws java.io.IOException
header
- the headerargs
- the list of arguments
java.io.IOException
protected java.lang.String getSessionTimestamp()
protected void writeSession() throws java.io.IOException
java.io.IOException
- if an error occurs writing to the logpublic void close()
close
in interface org.eclipse.osgi.framework.log.FrameworkLog
protected void openFile()
protected void closeFile()
public void log(FrameworkEvent frameworkEvent)
log
in interface org.eclipse.osgi.framework.log.FrameworkLog
public void log(org.eclipse.osgi.framework.log.FrameworkLogEntry logEntry)
log
in interface org.eclipse.osgi.framework.log.FrameworkLog
public void setWriter(java.io.Writer newWriter, boolean append)
setWriter
in interface org.eclipse.osgi.framework.log.FrameworkLog
public void setFile(java.io.File newFile, boolean append) throws java.io.IOException
setFile
in interface org.eclipse.osgi.framework.log.FrameworkLog
java.io.IOException
public java.io.File getFile()
getFile
in interface org.eclipse.osgi.framework.log.FrameworkLog
public void setConsoleLog(boolean consoleLog)
setConsoleLog
in interface org.eclipse.osgi.framework.log.FrameworkLog
protected java.lang.String getDate(java.util.Date date)
date
- the Date to format
protected java.lang.String getStackTrace(java.lang.Throwable t)
t
- the Throwable to get the stacktrace for
protected java.io.Writer logForStream(java.io.OutputStream output)
output
- an OutputStream to use for the Writer
protected void writeLog(int depth, org.eclipse.osgi.framework.log.FrameworkLogEntry entry) throws java.io.IOException
depth
- the depth of th entryentry
- the entry to log
java.io.IOException
- if any error occurs writing to the logprotected void writeEntry(int depth, org.eclipse.osgi.framework.log.FrameworkLogEntry entry) throws java.io.IOException
depth
- the depth of th entryentry
- the entry to write the header for
java.io.IOException
- if any error occurs writing to the logprotected void writeMessage(org.eclipse.osgi.framework.log.FrameworkLogEntry entry) throws java.io.IOException
entry
- the entry to write the message for
java.io.IOException
- if any error occurs writing to the logprotected void writeStack(org.eclipse.osgi.framework.log.FrameworkLogEntry entry) throws java.io.IOException
entry
- the entry to write the stacktrace for
java.io.IOException
- if any error occurs writing to the logprotected void write(java.lang.String message) throws java.io.IOException
message
- the message
java.io.IOException
- if any error occurs writing to the logprotected void writeln(java.lang.String s) throws java.io.IOException
s
- the message
java.io.IOException
- if any error occurs writing to the logprotected void writeln() throws java.io.IOException
java.io.IOException
- if any error occurs writing to the logprotected void writeSpace() throws java.io.IOException
java.io.IOException
- if any error occurs writing to the logprotected boolean checkLogFileSize()
protected void readLogProperties()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |