Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,9 @@ public CNAuditLogger(ConfigManager configManager) {
}

@Override
public void log(IAuditEntity auditLogFields, Supplier<String> log) {}
public void log(IAuditEntity auditLogFields, Supplier<String> log) {
if (!isAuditLogEnabled()) {
return;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,18 @@ private static InsertRowStatement generateInsertStatement(
public void createViewIfNecessary() {}

@Override
public synchronized void log(IAuditEntity auditLogFields, Supplier<String> log) {}
public synchronized void log(IAuditEntity auditLogFields, Supplier<String> log) {
if (!isAuditLogEnabled()) {
return;
}
}

public void logFromCN(AuditLogFields auditLogFields, String log, int nodeId)
throws IllegalPathException {}
throws IllegalPathException {
if (!isAuditLogEnabled()) {
return;
}
}

private static class DNAuditLoggerHolder {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,16 @@ public abstract class AbstractAuditLogger {
public static final String AUDIT_LOG_LOG = "log";

private static final CommonConfig CONFIG = CommonDescriptor.getInstance().getConfig();
protected static final boolean IS_AUDIT_LOG_ENABLED = CONFIG.isEnableAuditLog();

/**
* Check if audit log is enabled. This method reads the configuration dynamically instead of using
* a static final field to ensure that the configuration is properly loaded before being used.
*
* @return true if audit log is enabled, false otherwise
*/
protected static boolean isAuditLogEnabled() {
return CONFIG.isEnableAuditLog();
}

public abstract void log(IAuditEntity auditLogFields, Supplier<String> log);

Expand Down