Class GcLogTail
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
Reads the lines a file gains, between one call and the next: the GC log the JVM keeps writing.
public sealed class GcLogTail
- Inheritance
-
GcLogTail
- Inherited Members
Remarks
The JVM owns the file, so it is opened letting it go on writing, rotating and deleting
(FileShare.ReadWrite | Delete). A line the JVM is half way through writing is left for
the next call. When the JVM rotates the log, the file the app was reading becomes
gc.log.0 and a new gc.log starts; that shows as a shorter file or a different
beginning (every JVM log opens with its own uptime stamps), and reading starts again at the top.
A creation time would be simpler, but Linux filesystems often cannot tell it.
At most MaxBytesPerRead per call, so a long-forgotten tray window catching up never holds anything for long. Blocking file I/O: call it off the UI thread.
Constructors
GcLogTail(string)
public GcLogTail(string path)
Parameters
pathstring
Fields
MaxBytesPerRead
The most one call reads.
public const int MaxBytesPerRead = 262144
Field Value
Methods
ReadNewLines()
The complete lines written since the last call. Empty when the file is not there (yet).
public IReadOnlyList<string> ReadNewLines()