[Minor] don't log multiple times the exception on failed service
This commit is contained in:
parent
9505ab355c
commit
15ae2f9702
|
@ -569,7 +569,6 @@ public abstract class AbstractTransaction implements StrolchTransaction {
|
||||||
if (closeDuration >= 100000000L) {
|
if (closeDuration >= 100000000L) {
|
||||||
sb.append(", close="); //$NON-NLS-1$
|
sb.append(", close="); //$NON-NLS-1$
|
||||||
sb.append(StringHelper.formatNanoDuration(closeDuration));
|
sb.append(StringHelper.formatNanoDuration(closeDuration));
|
||||||
logger.info(sb.toString());
|
|
||||||
}
|
}
|
||||||
logger.error(sb.toString());
|
logger.error(sb.toString());
|
||||||
}
|
}
|
||||||
|
@ -600,7 +599,6 @@ public abstract class AbstractTransaction implements StrolchTransaction {
|
||||||
if (closeDuration >= 100000000L) {
|
if (closeDuration >= 100000000L) {
|
||||||
sb.append(", close="); //$NON-NLS-1$
|
sb.append(", close="); //$NON-NLS-1$
|
||||||
sb.append(StringHelper.formatNanoDuration(closeDuration));
|
sb.append(StringHelper.formatNanoDuration(closeDuration));
|
||||||
logger.info(sb.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String msg = "Strolch Transaction for realm {0} failed due to {1}\n{2}"; //$NON-NLS-1$
|
String msg = "Strolch Transaction for realm {0} failed due to {1}\n{2}"; //$NON-NLS-1$
|
||||||
|
|
|
@ -146,14 +146,9 @@ public abstract class AbstractService<T extends ServiceArgument, U extends Servi
|
||||||
return serviceResult;
|
return serviceResult;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
String msg = "Failed to perform service {0} due to {1}"; //$NON-NLS-1$
|
|
||||||
msg = MessageFormat.format(msg, getClass(), e.getMessage());
|
|
||||||
logger.error(msg, e);
|
|
||||||
|
|
||||||
U result = getResultInstance();
|
U result = getResultInstance();
|
||||||
result.setState(ServiceResultState.FAILED);
|
result.setState(ServiceResultState.FAILED);
|
||||||
result.setMessage(msg);
|
result.setMessage(e.getMessage());
|
||||||
result.setThrowable(e);
|
result.setThrowable(e);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,9 +86,11 @@ public class DefaultServiceHandler extends StrolchComponent implements ServiceHa
|
||||||
String msg = "User {0}: Service {1} failed after {2} due to {3}"; //$NON-NLS-1$
|
String msg = "User {0}: Service {1} failed after {2} due to {3}"; //$NON-NLS-1$
|
||||||
msg = MessageFormat.format(msg, username, service.getClass().getName(),
|
msg = MessageFormat.format(msg, username, service.getClass().getName(),
|
||||||
StringHelper.formatNanoDuration(end - start), e.getMessage());
|
StringHelper.formatNanoDuration(end - start), e.getMessage());
|
||||||
logger.error(msg, e);
|
logger.error(msg);
|
||||||
|
|
||||||
if (!this.throwOnPrivilegeFail && service instanceof AbstractService) {
|
if (!this.throwOnPrivilegeFail && service instanceof AbstractService) {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
|
||||||
AbstractService<?, ?> abstractService = (AbstractService<?, ?>) service;
|
AbstractService<?, ?> abstractService = (AbstractService<?, ?>) service;
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
U arg = (U) abstractService.getResultInstance();
|
U arg = (U) abstractService.getResultInstance();
|
||||||
|
@ -126,7 +128,7 @@ public class DefaultServiceHandler extends StrolchComponent implements ServiceHa
|
||||||
String msg = "User {0}: Service failed {1} after {2} due to {3}"; //$NON-NLS-1$
|
String msg = "User {0}: Service failed {1} after {2} due to {3}"; //$NON-NLS-1$
|
||||||
msg = MessageFormat.format(msg, username, service.getClass().getName(),
|
msg = MessageFormat.format(msg, username, service.getClass().getName(),
|
||||||
StringHelper.formatNanoDuration(end - start), e.getMessage());
|
StringHelper.formatNanoDuration(end - start), e.getMessage());
|
||||||
logger.error(msg, e);
|
logger.error(msg);
|
||||||
throw new StrolchException(msg, e);
|
throw new StrolchException(msg, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue