Design

Log entry in Java: long entryId, long timestamp, long duration, long agentId, long typeId, long status, long parentId, String message

Log entry type in DB: type_id, log_level, message_format

id - random long returned for log method call

parent_id - id of entry used for grouping this and related entries. Is negative for root entries and is the id of source of the entry client or server random id. Ranges are used to group by client/server kind (IDE client, app server, rest client).

timestamp - long with ms since epoch

agent_id - long agent id (numeric osee user id known by all systems using this log)

log_level - as defined by java.util.logging.Level

type_id - a fine-grained application defined type, random id, defined as tokens and stored in the db for cross application support

duration - starts at -1 and is never updated if duration does not apply, otherwise updates when the associated job ends with duration in ms

newly created log entries are added to newLogEntires using the entry_id as the key and the array of sql insert parameters as the value

updated log entries are checked for in newLogEntires and updated if they exist, otherwise the update map is checked and updated if exists, else added to updatedEntries

A timer tasks runs at a configurable (short) periodic rate and batch inserts the log entires in the insert map and then runs the updates. This means that any update to a log entry that occurs in less than this configured time will not require a database update (i.e. writing the duration of a short operation). This also means only one thread writes to the log table per JVM.

newLogEntires.values().iterator() is used to iterate through the values and remove them one at a time and add the batch insert collection

upon server shutdown must flush log

IDE client will directly use the same service that is used on the server