public class CrunchlogKernel
extends sirius.kernel.async.BackgroundLoop
implements sirius.kernel.health.console.Command, sirius.kernel.Stoppable, sirius.kernel.health.metrics.MetricProvider
This class should not be directly used outside the frameworks it integrates with. The public API resides in Crunchlog.
The implementation stores all incoming records in an internal buffer which is written to disk in one background thread.
The background thread ensures, that one file never spans more than one day and is also limited to be at most MAX_FILE_SIZE bytes large.
If a new file is started, it is ensured that the base directory exists and also that enough free space is avilable on the underlying disk.
If no new file can be created (due to the constraints named above), a warning is output once and all records are ignored until the outside circumstances have changed. The log will then automatically recover and start logging records. This behaviour is probably the best in many circumstances as neighter having the heap buffer grow indefinitely large nor having the filesystem run out of free space is feasible for a server system.
| Modifier and Type | Field and Description |
|---|---|
protected Queue<sirius.kernel.commons.Context> |
buffer |
| Constructor and Description |
|---|
CrunchlogKernel() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addToBuffer(sirius.kernel.commons.Context data) |
protected void |
collectAllCompletedFiles(Consumer<File> fileProcessor)
Implementation of
Crunchlog.collectAllCompletedFiles(Consumer) |
protected void |
doWork() |
void |
execute(sirius.kernel.health.console.Command.Output output,
String... strings) |
void |
gather(sirius.kernel.health.metrics.MetricsCollector collector) |
String |
getDescription() |
String |
getName() |
protected double |
maxCallFrequency() |
void |
stopped() |
determineExecutor, getExecutionInfo, loop, toStringprotected Queue<sirius.kernel.commons.Context> buffer
protected void addToBuffer(sirius.kernel.commons.Context data)
@Nonnull public String getName()
getName in interface sirius.kernel.di.std.NamedgetName in class sirius.kernel.async.BackgroundLoopprotected double maxCallFrequency()
maxCallFrequency in class sirius.kernel.async.BackgroundLoopprotected void doWork()
throws Exception
doWork in class sirius.kernel.async.BackgroundLoopExceptionpublic void stopped()
stopped in interface sirius.kernel.Stoppableprotected void collectAllCompletedFiles(Consumer<File> fileProcessor)
Crunchlog.collectAllCompletedFiles(Consumer)fileProcessor - the processor being supplied with all completed filespublic void gather(sirius.kernel.health.metrics.MetricsCollector collector)
gather in interface sirius.kernel.health.metrics.MetricProviderpublic void execute(sirius.kernel.health.console.Command.Output output,
String... strings)
throws Exception
execute in interface sirius.kernel.health.console.CommandExceptionpublic String getDescription()
getDescription in interface sirius.kernel.health.console.CommandCopyright © 2018. All rights reserved.