HADOOP-18808. LogExactlyOnce to add a debug() method (#5850)

Contributed by Steve Loughran
This commit is contained in:
Steve Loughran 2023-07-18 14:23:19 +01:00 committed by GitHub
parent 38ac2f7349
commit b3130056f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,4 +49,15 @@ public void error(String format, Object...args) {
log.error(format, args); log.error(format, args);
} }
} }
/**
* Log at DEBUG if nothing has been logged yet.
* @param format format string
* @param args arguments
*/
public void debug(String format, Object...args) {
if (!logged.getAndSet(true)) {
log.debug(format, args);
}
}
} }