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, 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 and 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`

  - ### 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 and Description
    `RollingLog(java.lang.String logFile, long logSize, boolean append)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

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

      `forEach, spliterator`

    - ### Methods inherited from interface org.eclipse.net4j.util.event.INotifier

      `addListener, getListeners, hasListeners, removeListener`

- - ### Constructor Detail

    - #### RollingLog

          public RollingLog(java.lang.String logFile,
                            long logSize,
                            boolean append)

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

    - #### log

          public final void log(java.lang.String message)

      Specified by:
        `log` in interface `Log`

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

      Specified by:
        `work` in class `Worker`
      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 class `Worker`
      Throws:
        `java.lang.Exception`

    - #### doDeactivate

          protected void doDeactivate()
                               throws java.lang.Exception

      Overrides:
        `doDeactivate` in class `Worker`
      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)

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `Lifecycle`

    - #### iterator

          public final CloseableIterator<RollingLog.LogLine> iterator()

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

    - #### iterator

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

    - #### main

          public static void main(java.lang.String[] args)

Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html