From 00b0d429893d668665ecf1b04da71c0a289c8b84 Mon Sep 17 00:00:00 2001 From: btangmu Date: Wed, 17 Jan 2024 12:40:01 -0500 Subject: [PATCH] CLDR-17248 Add logging for webdriver simulated users -Log whether enabled/disabled and why, and log success/failure for user creation --- .../java/org/unicode/cldr/web/AuthSurveyDriver.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/AuthSurveyDriver.java b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/AuthSurveyDriver.java index 8481be9f766..375cdfba0b3 100644 --- a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/AuthSurveyDriver.java +++ b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/AuthSurveyDriver.java @@ -20,6 +20,9 @@ public class AuthSurveyDriver { private static final int INVALID_USER_INDEX = -1; private static final int FIRST_VALID_USER_INDEX = 0; + public static final java.util.logging.Logger logger = + SurveyLog.forClass(AuthSurveyDriver.class); + private static boolean isInitialized = false; private static boolean isEnabled = false; private static String realPassword = null; @@ -46,12 +49,19 @@ public static User createTestUser(String password, String email) { } private static void initialize() { + String status; if (SurveyMain.isUnofficial()) { realPassword = CLDRConfig.getInstance().getProperty("CLDR_WEBDRIVER_PASSWORD", ""); if (realPassword != null && !realPassword.isBlank()) { isEnabled = true; + status = "enabled"; + } else { + status = "disabled, no property"; } + } else { + status = "disabled, official"; } + logger.info("Webdriver simulated users are " + status); isInitialized = true; } @@ -87,8 +97,10 @@ private static User addTestUser(String password, String email, int userIndex) { u.setPassword(password); User registeredUser = reg.newUser(null, u); if (registeredUser == null || registeredUser.id <= 0) { + logger.severe("Failed to add webdriver simulated user " + email); return null; } + logger.info("Added webdriver simulated user " + email); return registeredUser; } }