[Minor] Log exceptions of StrolchSystemAction
This commit is contained in:
parent
0dc11c74f9
commit
a2a0645f3b
|
@ -2,6 +2,8 @@ package li.strolch.runtime.privilege;
|
||||||
|
|
||||||
import li.strolch.privilege.handler.SystemAction;
|
import li.strolch.privilege.handler.SystemAction;
|
||||||
import li.strolch.privilege.model.PrivilegeContext;
|
import li.strolch.privilege.model.PrivilegeContext;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link SystemAction} to run {@link PrivilegedRunnable} as a system user
|
* {@link SystemAction} to run {@link PrivilegedRunnable} as a system user
|
||||||
|
@ -10,6 +12,8 @@ import li.strolch.privilege.model.PrivilegeContext;
|
||||||
*/
|
*/
|
||||||
public class StrolchSystemAction extends SystemAction {
|
public class StrolchSystemAction extends SystemAction {
|
||||||
|
|
||||||
|
public static final Logger logger = LoggerFactory.getLogger(StrolchSystemAction.class);
|
||||||
|
|
||||||
private PrivilegedRunnable runnable;
|
private PrivilegedRunnable runnable;
|
||||||
|
|
||||||
public StrolchSystemAction(PrivilegedRunnable runnable) {
|
public StrolchSystemAction(PrivilegedRunnable runnable) {
|
||||||
|
@ -18,6 +22,11 @@ public class StrolchSystemAction extends SystemAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(PrivilegeContext privilegeContext) {
|
public void execute(PrivilegeContext privilegeContext) {
|
||||||
this.runnable.run(privilegeContext);
|
try {
|
||||||
|
this.runnable.run(privilegeContext);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Failed to execute SystemAction for " + privilegeContext.getUsername() + " due to " + e
|
||||||
|
.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue