Web threads do not touch the log file, but simply queue messages to be written later by a worker thread. A lightweight CAS based locking mechanism is used to ensure than only 1 thread is active writing messages at any given time
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| private long | |
| private volatile boolean | |
| private String | |
| private static final String | |
| private final Path | |
| private final LogFileHeaderGenerator | |
| private boolean | |
| private boolean | |
| private final String | |
| private final String | |
| private final Executor | |
| private final Path | |
| private final Deque | |
| private final boolean | |
| private volatile int | |
| private static final AtomicIntegerFieldUpdater | |
| private BufferedWriter |
| Access | Constructor and Description |
|---|---|
| public | DefaultAccessLogReceiver(final Executor logWriteExecutor, final File outputDirectory, final String logBaseName)
|
| public | DefaultAccessLogReceiver(final Executor logWriteExecutor, final File outputDirectory, final String logBaseName, final String logNameSuffix)
|
| public | DefaultAccessLogReceiver(final Executor logWriteExecutor, final File outputDirectory, final String logBaseName, final String logNameSuffix, boolean rotate)
|
| public | DefaultAccessLogReceiver(final Executor logWriteExecutor, final Path outputDirectory, final String logBaseName)
|
| public | DefaultAccessLogReceiver(final Executor logWriteExecutor, final Path outputDirectory, final String logBaseName, final String logNameSuffix)
|
| public | DefaultAccessLogReceiver(final Executor logWriteExecutor, final Path outputDirectory, final String logBaseName, final String logNameSuffix, boolean rotate)
|
| private | DefaultAccessLogReceiver(final Executor logWriteExecutor, final Path outputDirectory, final String logBaseName, final String logNameSuffix, boolean rotate, LogFileHeaderGenerator fileHeader)
|
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| public static DefaultAccessLogReceiver. | |
| private void | |
| public void | close()
Implements java. Closes this stream and releases any system resources associated with it. |
| private void | |
| public void | logMessage(final String message)
Implements io.
|
| public void | |
| public void | |
| private void |
| changeOverPoint | back to summary |
|---|---|
| private long changeOverPoint | |
| closed | back to summary |
|---|---|
| private volatile boolean closed | |
| currentDateString | back to summary |
|---|---|
| private String currentDateString | |
| DEFAULT_LOG_SUFFIX | back to summary |
|---|---|
| private static final String DEFAULT_LOG_SUFFIX | |
| defaultLogFile | back to summary |
|---|---|
| private final Path defaultLogFile | |
| fileHeaderGenerator | back to summary |
|---|---|
| private final LogFileHeaderGenerator fileHeaderGenerator | |
| forceLogRotation | back to summary |
|---|---|
| private boolean forceLogRotation | |
| initialRun | back to summary |
|---|---|
| private boolean initialRun | |
| logBaseName | back to summary |
|---|---|
| private final String logBaseName | |
| logNameSuffix | back to summary |
|---|---|
| private final String logNameSuffix | |
| logWriteExecutor | back to summary |
|---|---|
| private final Executor logWriteExecutor | |
| outputDirectory | back to summary |
|---|---|
| private final Path outputDirectory | |
| pendingMessages | back to summary |
|---|---|
| private final Deque<String> pendingMessages | |
| rotate | back to summary |
|---|---|
| private final boolean rotate | |
| state | back to summary |
|---|---|
private volatile int state
| |
| stateUpdater | back to summary |
|---|---|
| private static final AtomicIntegerFieldUpdater<DefaultAccessLogReceiver> stateUpdater | |
| writer | back to summary |
|---|---|
| private BufferedWriter writer | |
| DefaultAccessLogReceiver | back to summary |
|---|---|
| public DefaultAccessLogReceiver(final Executor logWriteExecutor, final File outputDirectory, final String logBaseName) | |
| DefaultAccessLogReceiver | back to summary |
|---|---|
| public DefaultAccessLogReceiver(final Executor logWriteExecutor, final File outputDirectory, final String logBaseName, final String logNameSuffix) | |
| DefaultAccessLogReceiver | back to summary |
|---|---|
| public DefaultAccessLogReceiver(final Executor logWriteExecutor, final File outputDirectory, final String logBaseName, final String logNameSuffix, boolean rotate) | |
| DefaultAccessLogReceiver | back to summary |
|---|---|
| public DefaultAccessLogReceiver(final Executor logWriteExecutor, final Path outputDirectory, final String logBaseName) | |
| DefaultAccessLogReceiver | back to summary |
|---|---|
| public DefaultAccessLogReceiver(final Executor logWriteExecutor, final Path outputDirectory, final String logBaseName, final String logNameSuffix) | |
| DefaultAccessLogReceiver | back to summary |
|---|---|
| public DefaultAccessLogReceiver(final Executor logWriteExecutor, final Path outputDirectory, final String logBaseName, final String logNameSuffix, boolean rotate) | |
| DefaultAccessLogReceiver | back to summary |
|---|---|
| private DefaultAccessLogReceiver(final Executor logWriteExecutor, final Path outputDirectory, final String logBaseName, final String logNameSuffix, boolean rotate, LogFileHeaderGenerator fileHeader) | |
| awaitWrittenForTest | back to summary |
|---|---|
| pack-priv void awaitWrittenForTest() throws InterruptedException For tests only. Blocks the current thread until all messages are written Just does a busy wait. DO NOT USE THIS OUTSIDE OF A TEST | |
| builder | back to summary |
|---|---|
| public static DefaultAccessLogReceiver. | |
| calculateChangeOverPoint | back to summary |
|---|---|
| private void calculateChangeOverPoint() | |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements java. Doc from java. Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. As noted in
| |
| doRotate | back to summary |
|---|---|
| private void doRotate() | |
| logMessage | back to summary |
|---|---|
| public void logMessage(final String message) Implements io.
| |
| rotate | back to summary |
|---|---|
| public void rotate() forces a log rotation. This rotation is performed in an async manner, you cannot rely on the rotation being performed immediately after this method returns. | |
| run | back to summary |
|---|---|
| public void run() Implements java. processes all queued log messages
| |
| writeMessage | back to summary |
|---|---|
| private void writeMessage(final List<String> messages) | |
| Modifier and Type | Field and Description |
|---|---|
| private String | |
| private LogFileHeaderGenerator | |
| private String | |
| private Executor | |
| private Path | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public DefaultAccessLogReceiver | |
| public String | |
| public LogFileHeaderGenerator | |
| public String | |
| public Executor | |
| public Path | |
| public boolean | |
| public DefaultAccessLogReceiver. | |
| public DefaultAccessLogReceiver. | |
| public DefaultAccessLogReceiver. | |
| public DefaultAccessLogReceiver. | |
| public DefaultAccessLogReceiver. | |
| public DefaultAccessLogReceiver. |
| logBaseName | back to summary |
|---|---|
| private String logBaseName | |
| logFileHeaderGenerator | back to summary |
|---|---|
| private LogFileHeaderGenerator logFileHeaderGenerator | |
| logNameSuffix | back to summary |
|---|---|
| private String logNameSuffix | |
| logWriteExecutor | back to summary |
|---|---|
| private Executor logWriteExecutor | |
| outputDirectory | back to summary |
|---|---|
| private Path outputDirectory | |
| rotate | back to summary |
|---|---|
| private boolean rotate | |
| Builder | back to summary |
|---|---|
| public Builder() | |
| build | back to summary |
|---|---|
| public DefaultAccessLogReceiver build() | |
| getLogBaseName | back to summary |
|---|---|
| public String getLogBaseName() | |
| getLogFileHeaderGenerator | back to summary |
|---|---|
| public LogFileHeaderGenerator getLogFileHeaderGenerator() | |
| getLogNameSuffix | back to summary |
|---|---|
| public String getLogNameSuffix() | |
| getLogWriteExecutor | back to summary |
|---|---|
| public Executor getLogWriteExecutor() | |
| getOutputDirectory | back to summary |
|---|---|
| public Path getOutputDirectory() | |
| isRotate | back to summary |
|---|---|
| public boolean isRotate() | |
| setLogBaseName | back to summary |
|---|---|
| public DefaultAccessLogReceiver. | |
| setLogFileHeaderGenerator | back to summary |
|---|---|
| public DefaultAccessLogReceiver. | |
| setLogNameSuffix | back to summary |
|---|---|
| public DefaultAccessLogReceiver. | |
| setLogWriteExecutor | back to summary |
|---|---|
| public DefaultAccessLogReceiver. | |
| setOutputDirectory | back to summary |
|---|---|
| public DefaultAccessLogReceiver. | |
| setRotate | back to summary |
|---|---|
| public DefaultAccessLogReceiver. | |