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:
  `Iterable<RollingLog.LogLine>`, `INotifier`, `INotifier.INotifier2`, `IDeactivateable`, `ILifecycle`, `ILifecycle.DeferrableActivation`, `Log`

public class RollingLog extends Worker implements Log, Iterable<RollingLog.LogLine>

Since:
  3.8
Author:
  Eike Stepper

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static final class`
`RollingLog.LogLine`
`static final class`
`RollingLog.PropertiesEvent`
`static final class`
`RollingLog.RecoveryEvent`
`static class`
`RollingLog.RollingLogEvent`
`static final class`
`RollingLog.SplitEvent`

## Nested classes/interfaces inherited from class org.eclipse.net4j.util.concurrent.Worker

`Worker.Terminate, Worker.WorkContext`

## Nested classes/interfaces inherited from class org.eclipse.net4j.util.event.Notifier

`Notifier.Cancelation`

## 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`

### Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

`USE_LABEL`

## Constructor Summary

Constructors
Constructor
Description
`RollingLog(String logFile, long logSize, boolean append)`

## Method Summary

Modifier and Type
Method
Description
`final void`
`commit()`
`protected RollingLog.LogLine`
`createLogLine(String message)`
`protected void`
`doActivate()`
`protected void`
`doDeactivate()`
`final int`
`getFileNumber()`
`final String`
`getLogFile()`
`final long`
`getLogLineCounter()`
`final long`
`getLogSize()`
`protected String`
`getThreadInfo()`
`long`
`getWriteInterval()`
`boolean`
`isWriteBulk()`
`final CloseableIterator<RollingLog.LogLine>`
`iterator()`
`static CloseableIterator<RollingLog.LogLine>`
`iterator(String logFile)`
`protected void`
`load(Properties properties)`
`final void`
`log(String message)`
`static void`
`main(String[] args)`
`protected void`
`recovery(Properties properties, RollingLog.LogLine logLine)`
`protected void`
`save(Properties properties)`
`void`
`setWriteBulk(boolean writeBulk)`
`void`
`setWriteInterval(long writeInterval)`
`String`
`toString()`
`protected final void`
`work(Worker.WorkContext context)`
`protected void`
`writeLogLine(RollingLog.LogLine logLine, PrintStream out)`
`protected long`
`writeLogLines(List<RollingLog.LogLine> logLines)`
`protected long`
`writeLogLines(List<RollingLog.LogLine> logLines, 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`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

## Constructor Details

### RollingLog

public RollingLog(String logFile, long logSize, boolean append)

## Method Details

### getLogFile

public final 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)

### log

public final void log(String message)

Specified by:
  `log` in interface `Log`

### commit

public final void commit() throws InterruptedException

Throws:
  `InterruptedException`

### work

protected final void work(Worker.WorkContext context) throws Exception

Specified by:
  `work` in class `Worker`
Throws:
  `Exception`

### createLogLine

protected RollingLog.LogLine createLogLine(String message)

### writeLogLines

protected long writeLogLines(List<RollingLog.LogLine> logLines)

### writeLogLines

protected long writeLogLines(List<RollingLog.LogLine> logLines, PrintStream out)

### writeLogLine

protected void writeLogLine(RollingLog.LogLine logLine, PrintStream out)

### getThreadInfo

protected String getThreadInfo()

### doActivate

protected void doActivate() throws Exception

Overrides:
  `doActivate` in class `Worker`
Throws:
  `Exception`

### doDeactivate

protected void doDeactivate() throws Exception

Overrides:
  `doDeactivate` in class `Worker`
Throws:
  `Exception`

### recovery

protected void recovery(Properties properties, RollingLog.LogLine logLine)

### load

protected void load(Properties properties)

### save

protected void save(Properties properties)

### toString

public String toString()

Overrides:
  `toString` in class `Lifecycle`

### iterator

public final CloseableIterator<RollingLog.LogLine> iterator()

Specified by:
  `iterator` in interface `Iterable<RollingLog.LogLine>`

### iterator

public static CloseableIterator<RollingLog.LogLine> iterator(String logFile)

### main

public static void main(String[] args)