Migrate to Flogger (green)

This is a 'green' Flogger migration CL. Green CLs are intended to be as
safe as possible and should be easy to review and submit.

No changes should be necessary to the code itself prior to submission,
but small changes to BUILD files may be required.

Changes within files are completely independent of each other, so this CL
can be safely split up for review using tools such as Rosie.

For more information, see []
Base CL: 197826149

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198560170
This commit is contained in:
jianglai 2018-05-30 07:58:51 -07:00
parent 0d2fb3a8f0
commit 70b13596e4
178 changed files with 984 additions and 988 deletions

View file

@ -8,7 +8,6 @@ java_library(
name = "export",
srcs = glob(["*.java"]),
deps = [
"//java/com/google/common/logging:formatting_logger",
"//java/google/registry/bigquery",
"//java/google/registry/config",
"//java/google/registry/gcs",
@ -30,6 +29,8 @@ java_library(
"@com_google_appengine_tools_appengine_mapreduce",
"@com_google_code_findbugs_jsr305",
"@com_google_dagger",
"@com_google_flogger",
"@com_google_flogger_system_backend",
"@com_google_guava",
"@com_google_http_client",
"@com_googlecode_json_simple",

View file

@ -25,7 +25,7 @@ import com.google.appengine.api.taskqueue.Queue;
import com.google.appengine.api.taskqueue.TaskHandle;
import com.google.appengine.api.taskqueue.TaskOptions;
import com.google.appengine.api.taskqueue.TaskOptions.Method;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import dagger.Lazy;
import google.registry.request.Action;
import google.registry.request.Header;
@ -54,7 +54,7 @@ import org.joda.time.Duration;
)
public class BigqueryPollJobAction implements Runnable {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
static final String QUEUE = "export-bigquery-poll"; // See queue.xml
static final String PATH = "/_dr/task/pollBigqueryJob"; // See web.xml
@ -85,12 +85,9 @@ public class BigqueryPollJobAction implements Runnable {
throw new BadRequestException("Cannot deserialize task from payload", e);
}
String taskName = taskQueueUtils.enqueue(getQueue(chainedQueueName.get()), task).getName();
logger.infofmt(
logger.atInfo().log(
"Added chained task %s for %s to queue %s: %s",
taskName,
task.getUrl(),
chainedQueueName.get(),
task.toString());
taskName, task.getUrl(), chainedQueueName.get(), task);
}
/**
@ -106,7 +103,7 @@ public class BigqueryPollJobAction implements Runnable {
job = bigquery.jobs().get(projectId, jobId).execute();
} catch (IOException e) {
// We will throw a new exception because done==false, but first log this exception.
logger.warningfmt(e, "Error checking outcome of BigQuery job %s.", jobId);
logger.atWarning().withCause(e).log("Error checking outcome of BigQuery job %s.", jobId);
}
// If job is not yet done, then throw an exception so that we'll return a failing HTTP status
// code and the task will be retried.
@ -116,10 +113,10 @@ public class BigqueryPollJobAction implements Runnable {
// Check if the job ended with an error.
if (job.getStatus().getErrorResult() != null) {
logger.severefmt("Bigquery job failed - %s - %s", jobRefString, job);
logger.atSevere().log("Bigquery job failed - %s - %s", jobRefString, job);
return false;
}
logger.infofmt("Bigquery job succeeded - %s", jobRefString);
logger.atInfo().log("Bigquery job succeeded - %s", jobRefString);
return true;
}

View file

@ -15,7 +15,6 @@
package google.registry.export;
import static com.google.common.collect.Sets.intersection;
import static com.google.common.logging.FormattingLogger.getLoggerForCallerClass;
import static google.registry.export.LoadSnapshotAction.enqueueLoadSnapshotTask;
import static google.registry.request.Action.Method.GET;
import static google.registry.request.Action.Method.POST;
@ -28,7 +27,7 @@ import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import google.registry.export.DatastoreBackupInfo.BackupStatus;
import google.registry.request.Action;
import google.registry.request.HttpException.BadRequestException;
@ -69,7 +68,7 @@ public class CheckSnapshotAction implements Runnable {
/** The maximum amount of time we allow a backup to run before abandoning it. */
static final Duration MAXIMUM_BACKUP_RUNNING_TIME = Duration.standardHours(20);
private static final FormattingLogger logger = getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Inject Response response;
@Inject @RequestMethod Action.Method requestMethod;
@ -133,7 +132,7 @@ public class CheckSnapshotAction implements Runnable {
: backup.getStartTime().toString("YYYYMMdd_HHmmss");
// Log a warning if kindsToLoad is not a subset of the exported snapshot kinds.
if (!backup.getKinds().containsAll(kindsToLoad)) {
logger.warningfmt(
logger.atWarning().log(
"Kinds to load included non-exported kinds: %s",
Sets.difference(kindsToLoad, backup.getKinds()));
}
@ -147,7 +146,7 @@ public class CheckSnapshotAction implements Runnable {
enqueueLoadSnapshotTask(snapshotId, backup.getGcsFilename().get(), exportedKindsToLoad);
message += "BigQuery load task enqueued";
}
logger.info(message);
logger.atInfo().log(message);
response.setPayload(message);
}

View file

@ -31,7 +31,7 @@ import com.google.appengine.tools.mapreduce.ReducerInput;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import com.google.common.net.MediaType;
import google.registry.config.RegistryConfig.Config;
import google.registry.gcs.GcsUtils;
@ -60,7 +60,7 @@ import org.joda.time.DateTime;
@Action(path = "/_dr/task/exportDomainLists", method = POST, auth = Auth.AUTH_INTERNAL_ONLY)
public class ExportDomainListsAction implements Runnable {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
private static final int MAX_NUM_REDUCE_SHARDS = 100;
@Inject MapreduceRunner mrRunner;
@ -72,7 +72,7 @@ public class ExportDomainListsAction implements Runnable {
@Override
public void run() {
ImmutableSet<String> realTlds = getTldsOfType(TldType.REAL);
logger.infofmt("Exporting domain lists for tlds %s", realTlds);
logger.atInfo().log("Exporting domain lists for tlds %s", realTlds);
response.sendJavaScriptRedirect(createJobPath(mrRunner
.setJobName("Export domain lists")
.setModuleName("backend")
@ -131,7 +131,7 @@ public class ExportDomainListsAction implements Runnable {
try {
Registry registry = Registry.get(tld);
if (registry.getDriveFolderId() == null) {
logger.infofmt(
logger.atInfo().log(
"Skipping registered domains export for TLD %s because Drive folder isn't specified",
tld);
} else {
@ -141,12 +141,13 @@ public class ExportDomainListsAction implements Runnable {
EXPORT_MIME_TYPE,
registry.getDriveFolderId(),
domains.getBytes(UTF_8));
logger.infofmt(
logger.atInfo().log(
"Exporting registered domains succeeded for TLD %s, response was: %s",
tld, resultMsg);
}
} catch (Throwable e) {
logger.severefmt(e, "Error exporting registered domains for TLD %s to Drive", tld);
logger.atSevere().withCause(e).log(
"Error exporting registered domains for TLD %s to Drive", tld);
}
getContext().incrementCounter("domain lists written out to Drive");
}
@ -159,7 +160,8 @@ public class ExportDomainListsAction implements Runnable {
Writer osWriter = new OutputStreamWriter(gcsOutput, UTF_8)) {
osWriter.write(domains);
} catch (IOException e) {
logger.severefmt(e, "Error exporting registered domains for TLD %s to GCS.", tld);
logger.atSevere().withCause(e).log(
"Error exporting registered domains for TLD %s to GCS.", tld);
}
getContext().incrementCounter("domain lists written out to GCS");
}
@ -168,7 +170,7 @@ public class ExportDomainListsAction implements Runnable {
public void reduce(String tld, ReducerInput<String> fqdns) {
ImmutableList<String> domains = ImmutableList.sortedCopyOf(() -> fqdns);
String domainsList = Joiner.on('\n').join(domains);
logger.infofmt("Exporting %d domains for TLD %s to GCS and Drive.", domains.size(), tld);
logger.atInfo().log("Exporting %d domains for TLD %s to GCS and Drive.", domains.size(), tld);
exportToGcs(tld, domainsList);
exportToDrive(tld, domainsList);
}

View file

@ -21,7 +21,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
import static javax.servlet.http.HttpServletResponse.SC_OK;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import com.google.common.net.MediaType;
import google.registry.model.registry.Registry;
import google.registry.request.Action;
@ -40,7 +40,7 @@ import javax.inject.Inject;
)
public class ExportReservedTermsAction implements Runnable {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
static final MediaType EXPORT_MIME_TYPE = MediaType.PLAIN_TEXT_UTF_8;
static final String RESERVED_TERMS_FILENAME = "reserved_terms.txt";
@ -65,10 +65,10 @@ public class ExportReservedTermsAction implements Runnable {
String resultMsg;
if (registry.getReservedLists().isEmpty() && isNullOrEmpty(registry.getDriveFolderId())) {
resultMsg = "No reserved lists configured";
logger.infofmt("No reserved terms to export for TLD %s", tld);
logger.atInfo().log("No reserved terms to export for TLD %s", tld);
} else if (registry.getDriveFolderId() == null) {
resultMsg = "Skipping export because no Drive folder is associated with this TLD";
logger.infofmt(
logger.atInfo().log(
"Skipping reserved terms export for TLD %s because Drive folder isn't specified", tld);
} else {
resultMsg = driveConnection.createOrUpdateFile(
@ -76,8 +76,8 @@ public class ExportReservedTermsAction implements Runnable {
EXPORT_MIME_TYPE,
registry.getDriveFolderId(),
exportUtils.exportReservedTerms(registry).getBytes(UTF_8));
logger.infofmt("Exporting reserved terms succeeded for TLD %s, response was: %s",
tld, resultMsg);
logger.atInfo().log(
"Exporting reserved terms succeeded for TLD %s, response was: %s", tld, resultMsg);
}
response.setStatus(SC_OK);
response.setPayload(resultMsg);

View file

@ -17,7 +17,7 @@ package google.registry.export;
import static google.registry.export.CheckSnapshotAction.enqueuePollTask;
import static google.registry.request.Action.Method.POST;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import google.registry.config.RegistryConfig;
import google.registry.request.Action;
import google.registry.request.Response;
@ -54,7 +54,7 @@ public class ExportSnapshotAction implements Runnable {
/** Prefix to use for naming all snapshots that are started by this servlet. */
static final String SNAPSHOT_PREFIX = "auto_snapshot_";
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Inject Clock clock;
@Inject DatastoreBackupService backupService;
@ -72,7 +72,7 @@ public class ExportSnapshotAction implements Runnable {
// Enqueue a poll task to monitor the backup and load reporting-related kinds into bigquery.
enqueuePollTask(snapshotName, ExportConstants.getReportingKinds());
String message = "Datastore backup started with name: " + snapshotName;
logger.info(message);
logger.atInfo().log(message);
response.setPayload(message);
}
}

View file

@ -17,7 +17,6 @@ package google.registry.export;
import static com.google.appengine.api.taskqueue.QueueFactory.getQueue;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.logging.FormattingLogger.getLoggerForCallerClass;
import static google.registry.export.UpdateSnapshotViewAction.createViewUpdateTask;
import static google.registry.request.Action.Method.POST;
@ -34,7 +33,7 @@ import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import google.registry.bigquery.BigqueryFactory;
import google.registry.bigquery.BigqueryUtils.SourceFormat;
import google.registry.bigquery.BigqueryUtils.WriteDisposition;
@ -69,7 +68,7 @@ public class LoadSnapshotAction implements Runnable {
static final String QUEUE = "export-snapshot"; // See queue.xml.
static final String PATH = "/_dr/task/loadSnapshot"; // See web.xml.
private static final FormattingLogger logger = getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Inject BigqueryFactory bigqueryFactory;
@Inject BigqueryPollJobEnqueuer bigqueryPollEnqueuer;
@ -96,9 +95,9 @@ public class LoadSnapshotAction implements Runnable {
try {
String message =
loadSnapshot(snapshotId, snapshotFile, Splitter.on(',').split(snapshotKinds));
logger.infofmt("Loaded snapshot successfully: %s", message);
logger.atInfo().log("Loaded snapshot successfully: %s", message);
} catch (Throwable e) {
logger.severe(e, "Error loading snapshot");
logger.atSevere().withCause(e).log("Error loading snapshot");
if (e instanceof IllegalArgumentException) {
throw new BadRequestException("Error calling load snapshot: " + e.getMessage(), e);
} else {
@ -114,7 +113,7 @@ public class LoadSnapshotAction implements Runnable {
DateTime now = clock.nowUtc();
String loadMessage =
String.format("Loading Datastore snapshot %s from %s...", snapshotId, gcsFilename);
logger.info(loadMessage);
logger.atInfo().log(loadMessage);
StringBuilder builder = new StringBuilder(loadMessage + "\n");
builder.append("Load jobs:\n");
@ -136,7 +135,7 @@ public class LoadSnapshotAction implements Runnable {
getQueue(UpdateSnapshotViewAction.QUEUE));
builder.append(String.format(" - %s:%s\n", projectId, jobId));
logger.infofmt("Submitted load job %s:%s", projectId, jobId);
logger.atInfo().log("Submitted load job %s:%s", projectId, jobId);
}
return builder.toString();
}

View file

@ -20,8 +20,8 @@ import static google.registry.util.PreconditionsUtils.checkArgumentPresent;
import com.google.appengine.tools.cloudstorage.GcsFilename;
import com.google.common.collect.ImmutableMap;
import com.google.common.flogger.FluentLogger;
import com.google.common.io.ByteStreams;
import com.google.common.logging.FormattingLogger;
import com.google.common.net.MediaType;
import google.registry.gcs.GcsUtils;
import google.registry.model.registrar.Registrar;
@ -52,7 +52,7 @@ import javax.inject.Inject;
@Deprecated
public final class PublishDetailReportAction implements Runnable, JsonAction {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
/** MIME type to use for deposited report files in Drive. */
private static final MediaType REPORT_MIME_TYPE = MediaType.CSV_UTF_8;
@ -91,7 +91,7 @@ public final class PublishDetailReportAction implements Runnable, JsonAction {
@Override
public Map<String, Object> handleJsonRequest(Map<String, ?> json) {
try {
logger.infofmt("Publishing detail report for parameters: %s", json);
logger.atInfo().log("Publishing detail report for parameters: %s", json);
String registrarId = getParam(json, REGISTRAR_ID_PARAM);
Registrar registrar =
checkArgumentPresent(
@ -111,11 +111,9 @@ public final class PublishDetailReportAction implements Runnable, JsonAction {
REPORT_MIME_TYPE,
driveFolderId,
ByteStreams.toByteArray(input));
logger.infofmt("Published detail report for %s to folder %s using GCS file gs://%s/%s.",
registrarId,
driveFolderId,
gcsBucketName,
gcsObjectName);
logger.atInfo().log(
"Published detail report for %s to folder %s using GCS file gs://%s/%s.",
registrarId, driveFolderId, gcsBucketName, gcsObjectName);
return ImmutableMap.of("driveId", driveId);
} catch (FileNotFoundException e) {
throw new IllegalArgumentException(e.getMessage(), e);

View file

@ -27,7 +27,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import com.google.common.collect.Streams;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import google.registry.config.RegistryConfig.Config;
import google.registry.groups.GroupsConnection;
import google.registry.groups.GroupsConnection.Role;
@ -58,7 +58,7 @@ import javax.inject.Inject;
)
public final class SyncGroupMembersAction implements Runnable {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
private enum Result {
OK(SC_OK, "Group memberships successfully updated."),
@ -66,7 +66,7 @@ public final class SyncGroupMembersAction implements Runnable {
FAILED(SC_INTERNAL_SERVER_ERROR, "Error occurred while updating registrar contacts.") {
@Override
protected void log(Throwable cause) {
logger.severe(cause, message);
logger.atSevere().withCause(cause).log(message);
}};
final int statusCode;
@ -79,7 +79,7 @@ public final class SyncGroupMembersAction implements Runnable {
/** Log an error message. Results that use log levels other than info should override this. */
void log(@Nullable Throwable cause) {
logger.info(cause, message);
logger.atInfo().withCause(cause).log(message);
}
}
@ -134,7 +134,7 @@ public final class SyncGroupMembersAction implements Runnable {
retrier.callWithRetry(() -> syncRegistrarContacts(registrar), RuntimeException.class);
resultsBuilder.put(registrar, Optional.empty());
} catch (Throwable e) {
logger.severe(e, e.getMessage());
logger.atSevere().withCause(e).log(e.getMessage());
resultsBuilder.put(registrar, Optional.of(e));
}
}
@ -193,10 +193,9 @@ public final class SyncGroupMembersAction implements Runnable {
totalRemoved++;
}
}
logger.infofmt("Successfully synced contacts for registrar %s: added %d and removed %d",
registrar.getClientId(),
totalAdded,
totalRemoved);
logger.atInfo().log(
"Successfully synced contacts for registrar %s: added %d and removed %d",
registrar.getClientId(), totalAdded, totalRemoved);
} catch (IOException e) {
// Package up exception and re-throw with attached additional relevant info.
String msg = String.format("Couldn't sync contacts for registrar %s to group %s",

View file

@ -23,7 +23,7 @@ import com.google.api.services.bigquery.model.TableReference;
import com.google.api.services.bigquery.model.ViewDefinition;
import com.google.appengine.api.taskqueue.TaskOptions;
import com.google.appengine.api.taskqueue.TaskOptions.Method;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import google.registry.bigquery.BigqueryFactory;
import google.registry.config.RegistryConfig.Config;
import google.registry.request.Action;
@ -52,7 +52,7 @@ public class UpdateSnapshotViewAction implements Runnable {
static final String PATH = "/_dr/task/updateSnapshotView"; // See web.xml.
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Inject
@Parameter(UPDATE_SNAPSHOT_DATASET_ID_PARAM)
@ -101,8 +101,8 @@ public class UpdateSnapshotViewAction implements Runnable {
datasetId, tableId, kindName, STANDARD_LATEST_SNAPSHOT_DATASET, standardTemplate, false);
} catch (Throwable e) {
logger.severefmt(e, "Could not update snapshot view for table %s", tableId);
throw new InternalServerErrorException("Error in update snapshot view action");
throw new InternalServerErrorException(
String.format("Could not update snapshot view for table %s", tableId), e);
}
}
@ -134,7 +134,7 @@ public class UpdateSnapshotViewAction implements Runnable {
.put("SOURCE_TABLE", sourceTableId)
.build())));
logger.infofmt(
logger.atInfo().log(
"Updated view [%s:%s.%s] to point at snapshot table [%s:%s.%s].",
projectId, viewDataset, kindName, projectId, sourceDatasetId, sourceTableId);
}
@ -150,8 +150,8 @@ public class UpdateSnapshotViewAction implements Runnable {
if (e.getDetails().getCode() == 404) {
bigquery.tables().insert(ref.getProjectId(), ref.getDatasetId(), table).execute();
} else {
logger.warningfmt(
e, "UpdateSnapshotViewAction failed, caught exception %s", e.getDetails());
logger.atWarning().withCause(e).log(
"UpdateSnapshotViewAction failed, caught exception %s", e.getDetails());
}
}
}

View file

@ -8,7 +8,6 @@ java_library(
name = "sheet",
srcs = glob(["*.java"]),
deps = [
"//java/com/google/common/logging:formatting_logger",
"//java/google/registry/config",
"//java/google/registry/model",
"//java/google/registry/request",
@ -21,6 +20,8 @@ java_library(
"@com_google_appengine_api_1_0_sdk",
"@com_google_code_findbugs_jsr305",
"@com_google_dagger",
"@com_google_flogger",
"@com_google_flogger_system_backend",
"@com_google_guava",
"@com_google_http_client",
"@javax_servlet_api",

View file

@ -25,7 +25,7 @@ import com.google.api.services.sheets.v4.model.ClearValuesResponse;
import com.google.api.services.sheets.v4.model.ValueRange;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@ -34,7 +34,7 @@ import javax.inject.Inject;
/** Generic data synchronization utility for Google Spreadsheets. */
class SheetSynchronizer {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
private static final String SHEET_NAME = "Registrars";
@ -117,7 +117,7 @@ class SheetSynchronizer {
BatchUpdateValuesResponse response =
sheetsService.spreadsheets().values().batchUpdate(spreadsheetId, updateRequest).execute();
Integer cellsUpdated = response.getTotalUpdatedCells();
logger.infofmt("Updated %d originalVals", cellsUpdated != null ? cellsUpdated : 0);
logger.atInfo().log("Updated %d originalVals", cellsUpdated != null ? cellsUpdated : 0);
}
// Append extra rows if necessary
@ -139,7 +139,7 @@ class SheetSynchronizer {
.setValueInputOption("RAW")
.setInsertDataOption("INSERT_ROWS")
.execute();
logger.infofmt(
logger.atInfo().log(
"Appended %d rows to range %s",
data.size() - originalVals.size(), appendResponse.getTableRange());
// Clear the extra rows if necessary
@ -154,7 +154,7 @@ class SheetSynchronizer {
getRowRange(data.size(), originalVals.size()),
new ClearValuesRequest())
.execute();
logger.infofmt(
logger.atInfo().log(
"Cleared %d rows from range %s",
originalVals.size() - data.size(), clearResponse.getClearedRange());
}

View file

@ -27,7 +27,7 @@ import com.google.appengine.api.modules.ModulesService;
import com.google.appengine.api.modules.ModulesServiceFactory;
import com.google.appengine.api.taskqueue.TaskHandle;
import com.google.appengine.api.taskqueue.TaskOptions.Method;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import google.registry.config.RegistryConfig.Config;
import google.registry.request.Action;
import google.registry.request.Parameter;
@ -74,12 +74,12 @@ public class SyncRegistrarsSheetAction implements Runnable {
MISSINGNO(SC_BAD_REQUEST, "No sheet ID specified or configured; dropping task.") {
@Override
protected void log(Exception cause) {
logger.warning(cause, message);
logger.atWarning().withCause(cause).log(message);
}},
FAILED(SC_INTERNAL_SERVER_ERROR, "Spreadsheet synchronization failed") {
@Override
protected void log(Exception cause) {
logger.severe(cause, message);
logger.atSevere().withCause(cause).log(message);
}};
private final int statusCode;
@ -92,7 +92,7 @@ public class SyncRegistrarsSheetAction implements Runnable {
/** Log an error message. Results that use log levels other than info should override this. */
protected void log(@Nullable Exception cause) {
logger.info(cause, message);
logger.atInfo().withCause(cause).log(message);
}
private void send(Response response, @Nullable Exception cause) {
@ -106,7 +106,7 @@ public class SyncRegistrarsSheetAction implements Runnable {
public static final String PATH = "/_dr/task/syncRegistrarsSheet";
private static final String QUEUE = "sheet";
private static final String LOCK_NAME = "Synchronize registrars sheet";
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@NonFinalForTesting
private static ModulesService modulesService = ModulesServiceFactory.getModulesService();