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 classRollingLog.LogLinestatic classRollingLog.PropertiesEventstatic classRollingLog.RecoveryEventstatic classRollingLog.RollingLogEventstatic classRollingLog.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 voidcommit()protected RollingLog.LogLinecreateLogLine(java.lang.String message)protected voiddoActivate()protected voiddoDeactivate()intgetFileNumber()java.lang.StringgetLogFile()longgetLogLineCounter()longgetLogSize()protected java.lang.StringgetThreadInfo()longgetWriteInterval()booleanisWriteBulk()CloseableIterator<RollingLog.LogLine>iterator()static CloseableIterator<RollingLog.LogLine>iterator(java.lang.String logFile)protected voidload(java.util.Properties properties)voidlog(java.lang.String message)static voidmain(java.lang.String[] args)protected voidrecovery(java.util.Properties properties, RollingLog.LogLine logLine)protected voidsave(java.util.Properties properties)voidsetWriteBulk(boolean writeBulk)voidsetWriteInterval(long writeInterval)java.lang.StringtoString()protected voidwork(Worker.WorkContext context)protected voidwriteLogLine(RollingLog.LogLine logLine, java.io.PrintStream out)protected longwriteLogLines(java.util.List<RollingLog.LogLine> logLines)protected longwriteLogLines(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:
doActivatein classWorker- Throws:
java.lang.Exception
-
doDeactivate
protected void doDeactivate() throws java.lang.Exception- Overrides:
doDeactivatein 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:
iteratorin 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)
-
-