mirror of
https://github.com/google/nomulus
synced 2026-09-03 06:36:56 +00:00
Add logging statement for # of tasks in DNS queue
This will make DNS issues easier to debug retroactively as we will be able to determine, by looking at the logs, if the queue size was growing unbounded. Also adds some logging helpers to allow programmatically choosing the level of logging. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=163123783
This commit is contained in:
@@ -19,6 +19,7 @@ import com.google.common.collect.FluentIterable;
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/** Logging wrapper. */
|
||||
public class FormattingLogger {
|
||||
@@ -34,7 +35,15 @@ public class FormattingLogger {
|
||||
this.logger = Logger.getLogger(name);
|
||||
}
|
||||
|
||||
private void log(Level level, Throwable cause, String msg) {
|
||||
public void logfmt(Level level, Throwable cause, String fmt, Object... args) {
|
||||
log(level, cause, String.format(fmt, args));
|
||||
}
|
||||
|
||||
public void logfmt(Level level, String fmt, Object... args) {
|
||||
log(level, null, String.format(fmt, args));
|
||||
}
|
||||
|
||||
private void log(Level level, @Nullable Throwable cause, String msg) {
|
||||
StackTraceElement callerFrame = FluentIterable
|
||||
.from(new Exception().getStackTrace())
|
||||
.firstMatch(new Predicate<StackTraceElement>() {
|
||||
|
||||
Reference in New Issue
Block a user