Package org.eclipse.net4j.util.om.log
Class RollingLog
- java.lang.Object
-
- org.eclipse.net4j.util.event.Notifier
-
- org.eclipse.net4j.util.lifecycle.Lifecycle
-
- org.eclipse.net4j.util.concurrent.Worker
-
- org.eclipse.net4j.util.om.log.RollingLog
-
- All Implemented Interfaces:
java.lang.Iterable<RollingLog.LogLine>
,INotifier
,INotifier.INotifier2
,IDeactivateable
,ILifecycle
,ILifecycle.DeferrableActivation
,Log
public class RollingLog extends Worker implements Log, java.lang.Iterable<RollingLog.LogLine>
- Since:
- 3.8
- Author:
- Eike Stepper
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RollingLog.LogLine
static class
RollingLog.PropertiesEvent
static class
RollingLog.RecoveryEvent
static class
RollingLog.RollingLogEvent
static class
RollingLog.SplitEvent
-
Nested classes/interfaces inherited from class org.eclipse.net4j.util.concurrent.Worker
Worker.WorkContext
-
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle
ILifecycle.DeferrableActivation
-
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier
INotifier.INotifier2
-
-
Field Summary
-
Fields inherited from class org.eclipse.net4j.util.concurrent.Worker
DEFAULT_ERROR_HANDLER, DEFAULT_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description RollingLog(java.lang.String logFile, long logSize, boolean append)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
commit()
protected RollingLog.LogLine
createLogLine(java.lang.String message)
protected void
doActivate()
protected void
doDeactivate()
int
getFileNumber()
java.lang.String
getLogFile()
long
getLogLineCounter()
long
getLogSize()
protected java.lang.String
getThreadInfo()
long
getWriteInterval()
boolean
isWriteBulk()
CloseableIterator<RollingLog.LogLine>
iterator()
static CloseableIterator<RollingLog.LogLine>
iterator(java.lang.String logFile)
protected void
load(java.util.Properties properties)
void
log(java.lang.String message)
static void
main(java.lang.String[] args)
protected void
recovery(java.util.Properties properties, RollingLog.LogLine logLine)
protected void
save(java.util.Properties properties)
void
setWriteBulk(boolean writeBulk)
void
setWriteInterval(long writeInterval)
java.lang.String
toString()
protected void
work(Worker.WorkContext context)
protected void
writeLogLine(RollingLog.LogLine logLine, java.io.PrintStream out)
protected long
writeLogLines(java.util.List<RollingLog.LogLine> logLines)
protected long
writeLogLines(java.util.List<RollingLog.LogLine> logLines, java.io.PrintStream out)
-
Methods inherited from class org.eclipse.net4j.util.concurrent.Worker
getActivationTimeout, getDeactivationTimeout, getGlobalErrorHandler, getThreadName, getWorkerThread, handleError, isDaemon, setActivationTimeout, setDaemon, setDeactivationTimeout, setGlobalErrorHandler
-
Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doAfterActivate, doBeforeActivate, doBeforeDeactivate, dump, getLifecycleState, isActive, isDeferredActivation
-
Methods inherited from class org.eclipse.net4j.util.event.Notifier
addListener, addUniqueListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListener, hasListeners, lastListenerRemoved, listenerAdded, listenerRemoved, removeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.net4j.util.event.INotifier
addListener, getListeners, hasListeners, removeListener
-
-
-
-
Method Detail
-
getLogFile
public final java.lang.String getLogFile()
-
getLogSize
public final long getLogSize()
-
getLogLineCounter
public final long getLogLineCounter()
-
getFileNumber
public final int getFileNumber()
-
getWriteInterval
public long getWriteInterval()
-
setWriteInterval
public void setWriteInterval(long writeInterval)
-
isWriteBulk
public boolean isWriteBulk()
-
setWriteBulk
public void setWriteBulk(boolean writeBulk)
-
commit
public final void commit() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
work
protected final void work(Worker.WorkContext context) throws java.lang.Exception
-
createLogLine
protected RollingLog.LogLine createLogLine(java.lang.String message)
-
writeLogLines
protected long writeLogLines(java.util.List<RollingLog.LogLine> logLines)
-
writeLogLines
protected long writeLogLines(java.util.List<RollingLog.LogLine> logLines, java.io.PrintStream out)
-
writeLogLine
protected void writeLogLine(RollingLog.LogLine logLine, java.io.PrintStream out)
-
getThreadInfo
protected java.lang.String getThreadInfo()
-
doActivate
protected void doActivate() throws java.lang.Exception
- Overrides:
doActivate
in classWorker
- Throws:
java.lang.Exception
-
doDeactivate
protected void doDeactivate() throws java.lang.Exception
- Overrides:
doDeactivate
in classWorker
- Throws:
java.lang.Exception
-
recovery
protected void recovery(java.util.Properties properties, RollingLog.LogLine logLine)
-
load
protected void load(java.util.Properties properties)
-
save
protected void save(java.util.Properties properties)
-
iterator
public final CloseableIterator<RollingLog.LogLine> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<RollingLog.LogLine>
-
iterator
public static CloseableIterator<RollingLog.LogLine> iterator(java.lang.String logFile)
-
main
public static void main(java.lang.String[] args)
-
-