The LogDumper supports multiple application clients to log messages that are to be dumped to the server. The dumper application checks the logs of all the running applications that are registered to it, converts it to JSON and sends them to the server.
Usage: java -jar LogDumper.jar [server-host-name] [server-port]
While listing the raw user logs, each client log file is locked with an exclusive lock using FileLock and processed. The JSON translation happens after the lock is released to have the clients get access to the log file.
Note: The client applications are not blocked due to the exclusive lock as the LogDumperLib provides asynchronous logging.
Exceptions are modelled to have the upstream calls handle the excetions and accordings throws the exception. Custom exceptions may be added for better error reporting.
Note: Care has been taken to ensure that no user log data is lost during an error or graceful exit
The user raw logs are validated and modelled to a class DumperLog that is used by Jackson to create the JSON
The default processors/translators have been provided as a signleton that can be created using a factory method from the utility class (Check below section).
LogDumper: Orchestrates the entire workflow.
LogFileTracker:
Interface for the main client log processor.
LogTranslaotr:
Interface for the translating the user log to JSON/XML
DLogConnection:
Interface for the seting up the server connection (TCP/UDP etc)
LogFileTrackerImpl:
Default implementation of the processor. The main task of the processor is to lock client logs for processing and add it to a log-list and return the list of raw user log.
JsonTranslatorImpl:
The main taks of the JSON implementation of the translator is to form a JSON from the raw user log.
DefaultLogConnection:
Implemention of the TCP Connection to ther Dumper Server/
DumperLog:
Representation of the user log used by Jackson for JSON translation.
Constants:
The class has a few Constants and Enums
DumperLogHelper
Most of the frequest helper methods are defined here