Package org.gridgain.internal.mcp.audit
Class Log4j2AuditLogger
java.lang.Object
org.gridgain.internal.mcp.audit.Log4j2AuditLogger
- All Implemented Interfaces:
AuditLogger
Log4j2-based audit logger with structured JSON output.
Features (all provided by Log4j2):
- Asynchronous logging via AsyncLogger
- JSON Lines format via JsonTemplateLayout
- Automatic rotation via RollingFileAppender
- Automatic cleanup via DefaultRolloverStrategy
- Compression via .gz suffix in file pattern
All configuration is in log4j2-audit.xml. This class just writes structured data using ThreadContext.
-
Constructor Summary
ConstructorsConstructorDescriptionLog4j2AuditLogger(AuditConfiguration config) Constructs a new Log4j2 audit logger. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the audit logger and release resources.voidflush()Flush any buffered audit events to persistent storage.voidlog(AuditEvent event) Log an audit event asynchronously.
-
Constructor Details
-
Log4j2AuditLogger
Constructs a new Log4j2 audit logger.- Parameters:
config- audit configuration (for validation)
-
-
Method Details
-
log
Description copied from interface:AuditLoggerLog an audit event asynchronously.Implementations should not block the caller. Events are typically queued and written in background threads.
- Specified by:
login interfaceAuditLogger- Parameters:
event- the audit event to log
-
flush
public void flush()Description copied from interface:AuditLoggerFlush any buffered audit events to persistent storage.Called during graceful shutdown to ensure no events are lost. Implementations should block until all pending events are written.
- Specified by:
flushin interfaceAuditLogger
-
close
public void close()Description copied from interface:AuditLoggerClose the audit logger and release resources.Called during application shutdown. Should flush pending events and clean up any background threads or file handles.
- Specified by:
closein interfaceAuditLogger
-