KEYCLOAK-1280: i18n logging for org.keycloak.exportimport
This commit is contained in:
parent
24602257e1
commit
273c662b29
2 changed files with 36 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
||||||
package org.keycloak.exportimport;
|
package org.keycloak.exportimport;
|
||||||
|
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.keycloak.services.ServicesLogger;
|
||||||
import org.keycloak.models.KeycloakSession;
|
import org.keycloak.models.KeycloakSession;
|
||||||
import org.keycloak.models.KeycloakSessionFactory;
|
import org.keycloak.models.KeycloakSessionFactory;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public class ExportImportManager {
|
public class ExportImportManager {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ExportImportManager.class);
|
private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||||
|
|
||||||
private KeycloakSessionFactory sessionFactory;
|
private KeycloakSessionFactory sessionFactory;
|
||||||
|
|
||||||
|
@ -65,13 +65,13 @@ public class ExportImportManager {
|
||||||
try {
|
try {
|
||||||
Strategy strategy = ExportImportConfig.getStrategy();
|
Strategy strategy = ExportImportConfig.getStrategy();
|
||||||
if (realmName == null) {
|
if (realmName == null) {
|
||||||
logger.infof("Full model import requested. Strategy: %s", strategy.toString());
|
logger.fullModelImport(strategy.toString());
|
||||||
importProvider.importModel(sessionFactory, strategy);
|
importProvider.importModel(sessionFactory, strategy);
|
||||||
} else {
|
} else {
|
||||||
logger.infof("Import of realm '%s' requested. Strategy: %s", realmName, strategy.toString());
|
logger.realmImportRequested(realmName, strategy.toString());
|
||||||
importProvider.importRealm(sessionFactory, realmName, strategy);
|
importProvider.importRealm(sessionFactory, realmName, strategy);
|
||||||
}
|
}
|
||||||
logger.info("Import finished successfully");
|
logger.importSuccess();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException("Failed to run import", e);
|
throw new RuntimeException("Failed to run import", e);
|
||||||
}
|
}
|
||||||
|
@ -80,13 +80,13 @@ public class ExportImportManager {
|
||||||
public void runExport() {
|
public void runExport() {
|
||||||
try {
|
try {
|
||||||
if (realmName == null) {
|
if (realmName == null) {
|
||||||
logger.info("Full model export requested");
|
logger.fullModelExportRequested();
|
||||||
exportProvider.exportModel(sessionFactory);
|
exportProvider.exportModel(sessionFactory);
|
||||||
} else {
|
} else {
|
||||||
logger.infof("Export of realm '%s' requested", realmName);
|
logger.realmExportRequested(realmName);
|
||||||
exportProvider.exportRealm(sessionFactory, realmName);
|
exportProvider.exportRealm(sessionFactory, realmName);
|
||||||
}
|
}
|
||||||
logger.info("Export finished successfully");
|
logger.exportSuccess();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException("Failed to run export");
|
throw new RuntimeException("Failed to run export");
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,4 +152,32 @@ public interface ServicesLogger extends BasicLogger {
|
||||||
@LogMessage(level = ERROR)
|
@LogMessage(level = ERROR)
|
||||||
@Message(id=29, value="Failed to send email")
|
@Message(id=29, value="Failed to send email")
|
||||||
void failedToSendEmail(@Cause Exception e);
|
void failedToSendEmail(@Cause Exception e);
|
||||||
|
|
||||||
|
@LogMessage(level = INFO)
|
||||||
|
@Message(id=30, value="Full model import requested. Strategy: %s")
|
||||||
|
void fullModelImport(String strategy);
|
||||||
|
|
||||||
|
@LogMessage(level = INFO)
|
||||||
|
@Message(id=31, value="Import of realm '%s' requested. Strategy: %s")
|
||||||
|
void realmImportRequested(String realmName, String strategy);
|
||||||
|
|
||||||
|
@LogMessage(level = INFO)
|
||||||
|
@Message(id=32, value="Import finished successfully")
|
||||||
|
void importSuccess();
|
||||||
|
|
||||||
|
@LogMessage(level = INFO)
|
||||||
|
@Message(id=33, value="Full model export requested")
|
||||||
|
void fullModelExportRequested();
|
||||||
|
|
||||||
|
@LogMessage(level = INFO)
|
||||||
|
@Message(id=34, value="Export of realm '%s' requested.")
|
||||||
|
void realmExportRequested(String realmName);
|
||||||
|
|
||||||
|
@LogMessage(level = INFO)
|
||||||
|
@Message(id=35, value="Export finished successfully")
|
||||||
|
void exportSuccess();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue