|
SalesPoint Framework v3.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--log.Log
Represents a log file.
There is one global writable log file in the whole system. An instance
of LogCreator
is used to create the global log file as well as any local
log file.
Anything loggable must suit the Loggable
interface and must be able to
generate an instance of LogEntry
To read in log files see LogInputStream
.
Field Summary | |
protected ObjectOutputStream |
ooOutput
The log files output stream. |
protected static OutputStream |
theGlobalOutputStream
Reference to the global output stream. |
Constructor Summary | |
Log(OutputStream os)
Construct a new log file. |
Method Summary | |
void |
changeOutputStream(OutputStream os)
Change this log's outputstream. |
static void |
closeGlobalLog()
Closes the global log file if any log file was open. |
void |
closeLog()
Closes this Log file. |
static Log |
createLog(OutputStream os)
Create a new Log file using the current Log creator. |
protected void |
finalize()
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
static Log |
getGlobalLog()
Returns the current global log file. |
void |
log(Loggable l)
Adds one entry to the log file. |
protected void |
logCloseLog()
Add a log entry when closing the log file. |
protected void |
logOpenLog()
Add a log entry when opening the log file. |
static void |
setGlobalOutputStream(OutputStream newOutputStream)
Changes the current OutputStream of the global log file. |
static void |
setLogCreator(LogCreator lc)
Change the Log creator. |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected ObjectOutputStream ooOutput
changeOutputStream(java.io.OutputStream)
,
log(log.Loggable)
protected static OutputStream theGlobalOutputStream
Read Only
setGlobalOutputStream(java.io.OutputStream)
Constructor Detail |
public Log(OutputStream os)
os
- the outputstream to write to.Method Detail |
public void closeLog() throws IOException
closeGlobalLog()
protected void finalize() throws IOException
Disposes of this log file. If this is the global log file, calls
closeGlobalLog()
, else calls closeLog()
.
closeLog()
,
closeGlobalLog()
public void changeOutputStream(OutputStream os) throws IOException
If an outputstream exists it is closed prior to setting the new outputstream.
os
- the new output stream.setGlobalOutputStream(java.io.OutputStream)
protected void logCloseLog()
Currently does nothing. You can override this to write a log entry when the log file is being closed.
closeLog()
protected void logOpenLog()
Currently does nothing. You can override this to write a log entry when the log file is being opened.
changeOutputStream(java.io.OutputStream)
public void log(Loggable l) throws LogNoOutputStreamException, IOException
l
- the event to be logged.Loggable
public static Log getGlobalLog() throws LogNoOutputStreamException
If no log file exists, creates it using the Outputstream as specified
by setGlobalOutputStream(java.io.OutputStream)
setGlobalOutputStream()
has not been called yet.setGlobalOutputStream(java.io.OutputStream)
,
closeGlobalLog()
public static Log createLog(OutputStream os)
You should prefer calling this method to directly creating a new Log file as this method will provide an easy interface for adapting to new log classes.
os
- the OutputStream to be used.public static void setLogCreator(LogCreator lc)
Call to provide support for descended Log classes.
lc
- the log creator to be used when creating log files.getGlobalLog()
public static void closeGlobalLog() throws IOException
If no log file exists no exception is thrown. Closes the log file and it's OutputStream.
getGlobalLog()
,
setGlobalOutputStream(java.io.OutputStream)
public static void setGlobalOutputStream(OutputStream newOutputStream) throws IOException
This method must be called at least once before any global log operation takes place.
If an OutputStream exists it will be closed automatically. To close
the entire global log file use closeGlobalLog()
.
newOutputStream
- the new global output streamgetGlobalLog()
,
closeGlobalLog()
,
changeOutputStream(java.io.OutputStream)
|
SalesPoint Framework v3.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |