[Minor] don't log multiple times the exception on failed service

This commit is contained in:
Robert von Burg 2015-01-18 19:17:16 +01:00
parent 9505ab355c
commit 15ae2f9702
3 changed files with 5 additions and 10 deletions

View File

@ -569,7 +569,6 @@ public abstract class AbstractTransaction implements StrolchTransaction {
if (closeDuration >= 100000000L) {
sb.append(", close="); //$NON-NLS-1$
sb.append(StringHelper.formatNanoDuration(closeDuration));
logger.info(sb.toString());
}
logger.error(sb.toString());
}
@ -600,7 +599,6 @@ public abstract class AbstractTransaction implements StrolchTransaction {
if (closeDuration >= 100000000L) {
sb.append(", close="); //$NON-NLS-1$
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$

View File

@ -146,14 +146,9 @@ public abstract class AbstractService<T extends ServiceArgument, U extends Servi
return serviceResult;
} 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();
result.setState(ServiceResultState.FAILED);
result.setMessage(msg);
result.setMessage(e.getMessage());
result.setThrowable(e);
return result;
}

View File

@ -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$
msg = MessageFormat.format(msg, username, service.getClass().getName(),
StringHelper.formatNanoDuration(end - start), e.getMessage());
logger.error(msg, e);
logger.error(msg);
if (!this.throwOnPrivilegeFail && service instanceof AbstractService) {
logger.error(e.getMessage(), e);
AbstractService<?, ?> abstractService = (AbstractService<?, ?>) service;
@SuppressWarnings("unchecked")
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$
msg = MessageFormat.format(msg, username, service.getClass().getName(),
StringHelper.formatNanoDuration(end - start), e.getMessage());
logger.error(msg, e);
logger.error(msg);
throw new StrolchException(msg, e);
}
}