LogManager { static String appName(Map<String, String> env) { String appName = env.get("CORE_APP_NAME"); if (appName != null) { LOGGER.info("found CORE_APP_NAME env var, appName={}", appName); return appName; } appName = System.getProperty("core.appName"); if (appName == null) { LOGGER.info("not found -Dcore.appName, this should only happen in local dev env or test, use \"local\" as appName"); appName = "local"; } return appName; }  ActionLog begin(String message, String id); void end(String message); void logError(Throwable e); void maskFields(String... fields); static final ThreadLocal<ActionLog> CURRENT_ACTION_LOG; static final String APP_NAME; static final IdGenerator ID_GENERATOR; public LogAppender appender; }
@Test void appName() { assertThat(LogManager.appName(Map.of("CORE_APP_NAME", "test"))).isEqualTo("test"); assertThat(LogManager.appName(Map.of())).isEqualTo("local"); System.setProperty("core.appName", "test"); assertThat(LogManager.appName(Map.of())).isEqualTo("test"); System.clearProperty("core.appName"); }