|
Simple Log 2.0.1
[grlea] |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Writer org.grlea.log.rollover.RolloverManager
The RolloverManager is a Writer
implementation used by Simple Log to enable periodic
log-rolling functionality. It is a writer which writes to an "active" log file and, when told by
its RolloverStrategy
that the file is due to be rolled over, moves the content of the
active log file into a new rollover log file. Sufficient mechanics are employed to ensure that
no log content is lost while the roll over is being conducted.
Nested Class Summary | |
static interface |
RolloverManager.ErrorReporter
An interface for objects wishing to be notified of errors occurring in a RolloverManager while it is running. |
Field Summary |
Fields inherited from class java.io.Writer |
lock |
Constructor Summary | |
RolloverManager(java.util.Properties properties,
RolloverManager.ErrorReporter errorReporter)
Creates a new RolloverManager , configuring it with provided properties. |
Method Summary | |
void |
close()
Closes the file resources associated with this RolloverManager and releases any
other resources used by it. |
void |
configure(java.util.Properties properties)
Configures this RolloverManager using the given properties. |
static java.io.Writer |
createRolloverManager(java.util.Properties properties,
RolloverManager.ErrorReporter errorReporter)
|
void |
flush()
Does nothing, as the RolloverManager auto-flushes after every write() |
RolloverStrategy |
getStrategy()
Returns the RolloverStrategy object currently in use by this
RolloverManager . |
void |
rolloverIfNecessary()
Prompts the RolloverManager to check whether the log file needs to be rolled and
to perform that rolling if necessary. |
void |
setStrategy(RolloverStrategy strategy)
Sets the RolloverStrategy to be used by this RolloverManager . |
void |
write(char[] cbuf,
int off,
int len)
Writes the output to the current writer and flushes it. |
Methods inherited from class java.io.Writer |
write, write, write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RolloverManager(java.util.Properties properties, RolloverManager.ErrorReporter errorReporter) throws java.io.IOException
RolloverManager
, configuring it with provided properties. The given
RolloverManager.ErrorReporter
object is retained and used to report errors for the life of the new
RolloverManager
instance.
properties
- properties to be used to configure the new RolloverManager
errorReporter
- and object to which errors that occur while the
RolloverManager
is running will be reported. May be null
.
java.io.IOException
- if an error occurs while configuring the RolloverManager
or
opening the files it will be logging to.
java.lang.IllegalArgumentException
- if properties
is null
.Method Detail |
public void configure(java.util.Properties properties) throws java.io.IOException
RolloverManager
using the given properties.
properties
- properties to be used to configure this RolloverManager
java.io.IOException
- if an error occurs while configuring the RolloverManager
or
opening the files it will be logging to.public void close()
RolloverManager
and releases any
other resources used by it. Any errors occurring during this operation are captured and
reported to the error reporter.
public void flush()
RolloverManager
auto-flushes after every write()
public void write(char[] cbuf, int off, int len) throws java.io.IOException
java.io.IOException
- if an error occurs writing to the current writer.public void rolloverIfNecessary() throws java.io.IOException
RolloverManager
to check whether the log file needs to be rolled and
to perform that rolling if necessary.
java.io.IOException
- if an error occurs while rolling the log file.public RolloverStrategy getStrategy()
RolloverStrategy
object currently in use by this
RolloverManager
.
public void setStrategy(RolloverStrategy strategy)
RolloverStrategy
to be used by this RolloverManager
. Once the
strategy has been set using this method, it will never be changed by calls to
configure(java.util.Properties)
, which includes auto-reloading of the properties.
strategy
- the new strategy implementation to be used
java.lang.IllegalArgumentException
- if strategy
is null
.public static java.io.Writer createRolloverManager(java.util.Properties properties, RolloverManager.ErrorReporter errorReporter) throws java.io.IOException
java.io.IOException
|
Copyright (c) 2004-2006, Graham Lea. All rights reserved. |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |