KEYCLOAK-1280: i18n logging for org.keycloak.services.scheduled
This commit is contained in:
parent
446cd3701f
commit
c6dd0d52b9
2 changed files with 12 additions and 4 deletions
|
@ -393,4 +393,12 @@ public interface ServicesLogger extends BasicLogger {
|
|||
@LogMessage(level = ERROR)
|
||||
@Message(id=88, value="Failed to send execute actions email")
|
||||
void failedToSendActionsEmail(@Cause EmailException e);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(id=89, value="Failed to run scheduled task %s")
|
||||
void failedToRunScheduledTask(@Cause Throwable t, String taskClass);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(id=90, value="Failed to close ProviderSession")
|
||||
void failedToCloseProviderSession(@Cause Throwable t);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package org.keycloak.services.scheduled;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.KeycloakSessionFactory;
|
||||
import org.keycloak.services.ServicesLogger;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
public class ScheduledTaskRunner implements Runnable {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ScheduledTaskRunner.class);
|
||||
private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
|
||||
|
||||
private final KeycloakSessionFactory sessionFactory;
|
||||
private final ScheduledTask task;
|
||||
|
@ -29,14 +29,14 @@ public class ScheduledTaskRunner implements Runnable {
|
|||
|
||||
logger.debug("Executed scheduled task " + task.getClass().getSimpleName());
|
||||
} catch (Throwable t) {
|
||||
logger.error("Failed to run scheduled task " + task.getClass().getSimpleName(), t);
|
||||
logger.failedToRunScheduledTask(t, task.getClass().getSimpleName());
|
||||
|
||||
session.getTransaction().rollback();
|
||||
} finally {
|
||||
try {
|
||||
session.close();
|
||||
} catch (Throwable t) {
|
||||
logger.error("Failed to close ProviderSession", t);
|
||||
logger.failedToCloseProviderSession(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue