Skip to content

Commit

Permalink
fix logger parameter placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
SavvasMisaghMoayyed committed Mar 5, 2018
1 parent d7aafcc commit c707b35
Show file tree
Hide file tree
Showing 35 changed files with 55 additions and 56 deletions.
Expand Up @@ -263,7 +263,7 @@ protected ObjectQuery getChooseQuery() {
query.setFilter(filter);
}
} catch (SchemaException ex) {
LOGGER.error("Couldn't create query filter for ShadowType popup list" , ex.getErrorTypeMessage());
LOGGER.error("Couldn't create query filter for ShadowType popup list: {}" , ex.getErrorTypeMessage());
}
return query;
}
Expand Down Expand Up @@ -431,7 +431,7 @@ private List<String> getLiteralValues(){
try{
return ExpressionUtil.getLiteralExpressionValues(getModelObject());
} catch (SchemaException ex){
LOGGER.error("Couldn't get literal expression value, ", ex.getLocalizedMessage());
LOGGER.error("Couldn't get literal expression value: {}", ex.getLocalizedMessage());
}
return literalValueList;
}
Expand Down
Expand Up @@ -475,7 +475,7 @@ private List<TaskType> getTasksForKind(List<PrismObject<TaskType>> tasks) {
.findProperty(new ItemPath(TaskType.F_EXTENSION, SchemaConstants.OBJECTCLASS_PROPERTY_NAME));

if (taskObjectClass == null) {
LOGGER.warn("Bad task definition. Task {} doesn't contain definition either of objectClass or kind/intent");
LOGGER.warn("Bad task definition. Task {} doesn't contain definition either of objectClass or kind/intent", task.getOid());
continue;
}

Expand Down
Expand Up @@ -252,7 +252,7 @@ private void propagatePassword(AjaxRequestTarget target,
try {
token = authenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(userModel.getObject().getName().getOrig(), value));
} catch (Exception ex) {
LOGGER.error("Failed to authenticate user, reason ", ex.getMessage());
LOGGER.error("Failed to authenticate user, reason {}", ex.getMessage());
getSession().error(getString("PageAccountActivation.authentication.failed"));
throw new RestartResponseException(PageAccountActivation.class, getPageParameters());
}
Expand Down
Expand Up @@ -274,7 +274,7 @@ public static void securitySelfTest(OperationResult parentTestResult) {
providerResult.addContext("properties", propXml);
providerResult.recordSuccess();
} catch (Throwable e) {
LOGGER.error("Security self test (provider properties) failed: ", e.getMessage() ,e);
LOGGER.error("Security self test (provider properties) failed: {}", e.getMessage() ,e);
providerResult.recordFatalError(e);
}
}
Expand Down Expand Up @@ -341,11 +341,11 @@ private static void securitySelfTestAlgorithm(String algorithmName, String trans
new Object[] {algorithmName, transformationName, keySize});
} catch (Throwable e) {
if (critical) {
LOGGER.error("Security self test (algorithmName={}, transformationName={}, keySize={}) failed: {}",
LOGGER.error("Security self test (algorithmName={}, transformationName={}, keySize={}) failed: {}-{}",
new Object[] {algorithmName, transformationName, keySize, e.getMessage() ,e});
subresult.recordFatalError(e);
} else {
LOGGER.warn("Security self test (algorithmName={}, transformationName={}, keySize={}) failed: {} (failure is expected in some cases)",
LOGGER.warn("Security self test (algorithmName={}, transformationName={}, keySize={}) failed: {}-{} (failure is expected in some cases)",
new Object[] {algorithmName, transformationName, keySize, e.getMessage() ,e});
subresult.recordWarning(e);
}
Expand Down
Expand Up @@ -93,11 +93,11 @@ public InputSource resolveEntity(String publicId, String systemId) throws SAXExc
LOGGER.trace("Resolved entity '{}', '{}': '{}' (resolver: {})", new Object[] { publicId, systemId, source, entityResolver});
return source;
} catch (SAXException e) {
LOGGER.error("XML error resolving entity '{}', '{}': '{}'",
LOGGER.error("XML error resolving entity '{}', '{}': '{}-{}'",
new Object[] { publicId, systemId, e.getMessage(), e });
throw e;
} catch (IOException e) {
LOGGER.error("IO error resolving entity '{}', '{}': '{}'",
LOGGER.error("IO error resolving entity '{}', '{}': '{}-{}'",
new Object[] { publicId, systemId, e.getMessage(), e });
throw e;
}
Expand Down
Expand Up @@ -171,8 +171,8 @@ public static void assertElement(List<Object> elements, QName elementQName, Stri
}

public static void assertExceptionSanity(ObjectAlreadyExistsException e) {
LOGGER.debug("Excpetion (expected)", e, e);
System.out.println("Excpetion (expected)");
LOGGER.debug("Exception (expected) {}", e, e);
System.out.println("Exception (expected)");
System.out.println(ExceptionUtils.getFullStackTrace(e));
assert !e.getMessage().isEmpty() : "Empty exception message";
assert e.getMessage().length() < MAX_EXCEPTION_MESSAGE_LENGTH : "Exception message too long ("
Expand Down
Expand Up @@ -204,7 +204,7 @@ public static boolean extractFilesFromClassPath(String srcPath, String dstPath,

// skip other files
if (!jarEntry.getName().contains(srcPath)) {
LOGGER.trace("Not relevant: ", jarEntry.getName());
LOGGER.trace("Not relevant: {}", jarEntry.getName());
continue;
}

Expand Down
Expand Up @@ -68,7 +68,7 @@ public Object evaluate(List argList) throws XPathFunctionException {
} catch (InvocationTargetException e) {
throw new XPathFunctionException(e);
} catch (NoSuchMethodException e) {
LOGGER.error("Cannot find {} function with {} arguments", new Object[]{functionName, arity, e});
LOGGER.error("Cannot find {} function with {} arguments: {}", new Object[]{functionName, arity, e});
throw new XPathFunctionException(e);
}

Expand Down
Expand Up @@ -635,7 +635,7 @@ private void traceNotApplicable(String reason) {
}

private void traceFailure(Throwable e) {
LOGGER.error("Error evaluating {}: {}", new Object[]{getMappingContextDescription(), e.getMessage(), e});
LOGGER.error("Error evaluating {}: {}-{}", new Object[]{getMappingContextDescription(), e.getMessage(), e});
traceEvaluationEnd();
if (!isTrace()) {
return;
Expand Down
Expand Up @@ -424,7 +424,7 @@ public RefinedObjectClassDefinition getEditObjectClassDefinition(PrismObject<Sha
RefinedResourceSchema refinedSchema = RefinedResourceSchemaImpl.getRefinedSchema(resource);
CompositeRefinedObjectClassDefinition rocd = refinedSchema.determineCompositeObjectClassDefinition(shadow);
if (rocd == null) {
LOGGER.debug("No object class definition for shadow {}, returning null");
LOGGER.debug("No object class definition for shadow {}, returning null", shadow.getOid());
return null;
}
LayerRefinedObjectClassDefinition layeredROCD = rocd.forLayer(LayerType.PRESENTATION);
Expand Down Expand Up @@ -993,7 +993,7 @@ public <O extends ObjectType> void generateValue(PrismObject<O> object, PolicyIt
generateValue(object, valuePolicy, policyItemDefinition, task, generateValueResult);
} catch (ExpressionEvaluationException | SchemaException | ObjectNotFoundException
| CommunicationException | ConfigurationException | SecurityViolationException e) {
LOGGER.error("Failed to generate value for {} " + policyItemDefinition, e);
LOGGER.error("Failed to generate value for {} ", policyItemDefinition, e);
generateValueResult.recordFatalError("Failed to generate value for " + policyItemDefinition + ". Reason: " + e.getMessage(), e);
policyItemDefinition.setResult(generateValueResult.createOperationResultType());
continue;
Expand Down
Expand Up @@ -1345,7 +1345,7 @@ public Map<String, String> parseXmlToMap(String xml) {
value = null;
}
} else {
LOGGER.trace("No value between xml tags, tag name : {0}", endName);
LOGGER.trace("No value between xml tags, tag name : {}", endName);
}

} else if (code == XMLStreamConstants.END_DOCUMENT) {
Expand Down
Expand Up @@ -173,7 +173,7 @@ public void setStrengthSelector(StrengthSelector strengthSelector) {
@NotNull
public ItemDelta<V,D> consolidateToDelta() throws ExpressionEvaluationException, PolicyViolationException, SchemaException {
if (strengthSelector.isNone()) {
LOGGER.trace("Consolidation of {} skipped as strength selector is 'none'");
LOGGER.trace("Consolidation of {} skipped as strength selector is 'none'", itemPath);
return null;
}

Expand Down Expand Up @@ -350,7 +350,7 @@ public ItemDelta<V,D> consolidateToDelta() throws ExpressionEvaluationException,

if (weakOnly && !strengthSelector.isWeak() && (itemExisting == null || itemExisting.isEmpty())){
// There is a weak mapping on a property, but we do not have full account available, so skipping deletion of the value is better way
LOGGER.trace("Value {} mapping is weak and the full account could not be fetched, skipping deletion in {}",
LOGGER.trace("Value {} mapping is weak and the full account could not be fetched, skipping deletion in {} with context {}",
value, itemPath, contextDescription);
continue;
}
Expand Down
Expand Up @@ -340,7 +340,7 @@ public <F extends FocusType> void personaDelete(LensContext<F> context, PersonaK
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException,
CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException, PreconditionViolationException {
PrismObject<F> focus = context.getFocusContext().getObjectOld();
LOGGER.debug("Deleting persona {} for {}: ", key, focus, existingPersona);
LOGGER.debug("Deleting persona {} for {}: {}", key, focus, existingPersona);
ObjectDelta<? extends FocusType> targetDelta = existingPersona.asPrismObject().createDeleteDelta();

executePersonaDelta(targetDelta, task, result);
Expand Down
Expand Up @@ -1014,13 +1014,13 @@ private <T> boolean isToBeDeleted(ItemDelta existingDelta, ValueMatcher valueMat
if (isInDeltaValue instanceof PrismPropertyValue){
PrismPropertyValue isInRealValue = (PrismPropertyValue) isInDeltaValue;
if (matchValue(isInRealValue.getValue(), value, valueMatcher)) {
LOGGER.trace("Skipping adding value {} to delta for DELETE because it's already there");
LOGGER.trace("Skipping adding value {} to delta for DELETE because it's already there", value);
return true;
}
} else if (isInDeltaValue instanceof PrismContainerValue) {
PrismContainerValue isInRealValue = (PrismContainerValue) isInDeltaValue;
if (matchValue(isInRealValue.asContainerable(), value, valueMatcher)){
LOGGER.trace("Skipping adding value {} to delta for DELETE because it's already there");
LOGGER.trace("Skipping adding value {} to delta for DELETE because it's already there", value);
return true;
}
} //TODO: reference delta???
Expand Down
Expand Up @@ -325,7 +325,7 @@ public boolean before(ResourceShadowDiscriminator rat) {

if (SchemaConstants.CHANGE_CHANNEL_DISCOVERY.equals(QNameUtil.uriToQName(context.getChannel()))) {
LOGGER.trace(
"Processing of shadow identified by {} will be skipped because of limitation for discovery channel."); // TODO is this message OK? [med]
"Processing of shadow identified by {} will be skipped because of limitation for discovery channel.", context.getChannel()); // TODO is this message OK? [med]
processOnlyExistingProjCxts = true;
}
}
Expand Down
Expand Up @@ -138,7 +138,7 @@ private <F extends FocusType> void processLifecycleWithFocus(LensContext<F> cont
LOGGER.debug("Lifecycle state transition of {}: {} -> {}", objectNew, startLifecycleState, targetLifecycleState);
recordLifecycleTransitionDelta(focusContext, targetLifecycleState);
executeEntryActions(context, lifecycleStateModel, targetLifecycleState, now, task, result);
LOGGER.trace("Lifecycle state transition of {} to {} done", objectNew, startLifecycleState, targetLifecycleState);
LOGGER.trace("Lifecycle state transition of {} from {} to {} done", objectNew, startLifecycleState, targetLifecycleState);
break;
}
}
Expand Down
Expand Up @@ -563,7 +563,7 @@ private <V extends PrismValue, D extends ItemDefinition, F extends FocusType> bo
}

private void resolveEntitlement(PrismContainerValue<ShadowAssociationType> value, LensProjectionContext projContext, ExpressionVariables variables) {
LOGGER.trace("Producing value {} " + value);
LOGGER.trace("Producing value {} ", value);
PrismObject<ShadowType> entitlement = projContext.getEntitlementMap().get(value.findReference(ShadowAssociationType.F_SHADOW_REF).getOid());
LOGGER.trace("Resolved entitlement {}", entitlement);
if (variables.containsKey(ExpressionConstants.VAR_ENTITLEMENT)) {
Expand Down
Expand Up @@ -81,7 +81,7 @@ public TaskRunResult run(Task task) {
try {
ScriptExecutionResult executionResult = scriptingService.evaluateExpression(executeScriptProperty.getRealValue(), emptyMap(), task, result);
LOGGER.debug("Execution output: {} item(s)", executionResult.getDataOutput().size());
LOGGER.debug("Execution result:\n", executionResult.getConsoleOutput());
LOGGER.debug("Execution result:\n{}", executionResult.getConsoleOutput());
result.computeStatus();
runResult.setRunResultStatus(TaskRunResult.TaskRunResultStatus.FINISHED);
} catch (ScriptExecutionException | SecurityViolationException | SchemaException | ObjectNotFoundException | ExpressionEvaluationException | CommunicationException | ConfigurationException e) {
Expand Down
Expand Up @@ -76,7 +76,7 @@ public PipelineData execute(ActionExpressionType expression, PipelineData input,
Throwable exception = null;
try {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Recomputing object {} with dryRun={}: context:\n{}", focalPrismObject, dryRun);
LOGGER.trace("Recomputing object {} with dryRun={}", focalPrismObject, dryRun);
}
ObjectDelta<? extends FocusType> emptyDelta = ObjectDelta.createEmptyDelta(focusType.getClass(), focusType.getOid(), prismContext, ChangeType.MODIFY);
operationsHelper.applyDelta(emptyDelta, ModelExecuteOptions.createReconcile(), dryRun, context, result);
Expand Down
Expand Up @@ -39,7 +39,7 @@ public WsFaultListener(SecurityHelper securityHelper) {

@Override
public boolean faultOccurred(Exception exception, String description, Message message) {
LOGGER.trace("Handling fault: {}: {} - {}", new Object[]{exception, description, message, exception});
LOGGER.trace("Handling fault: {}: {} - {}-{}", new Object[]{exception, description, message, exception});
Object audited = message.getContextualProperty(SecurityHelper.CONTEXTUAL_PROPERTY_AUDITED_NAME);
if (audited != null && ((Boolean)audited)) {
return true;
Expand Down Expand Up @@ -74,4 +74,4 @@ public boolean faultOccurred(Exception exception, String description, Message me
}


}
}
Expand Up @@ -394,7 +394,7 @@ private void processInterruption(TaskRunResult runResult, PrismObject<ResourceTy
private void processErrorFinal(TaskRunResult runResult, String errorDesc, Exception ex,
TaskRunResultStatus runResultStatus, PrismObject<ResourceType> resource, Task task, OperationResult opResult) {
String message = errorDesc+": "+ex.getMessage();
LOGGER.error("Reconciliation: {}", new Object[]{message, ex});
LOGGER.error("Reconciliation: {}-{}", new Object[]{message, ex});
opResult.recordFatalError(message, ex);
TaskHandlerUtil.appendLastFailuresInformation(OperationConstants.RECONCILIATION, task, opResult); // TODO implement more seriously
runResult.setRunResultStatus(runResultStatus);
Expand All @@ -414,7 +414,7 @@ private void processErrorPartial(TaskRunResult runResult, String errorDesc, Exce
} else {
message = errorDesc+": "+ex.getMessage();
}
LOGGER.error("Reconciliation: {}", new Object[]{message, ex});
LOGGER.error("Reconciliation: {}-{}", new Object[]{message, ex});
opResult.recordFatalError(message, ex);
runResult.setRunResultStatus(runResultStatus);
}
Expand Down
Expand Up @@ -144,7 +144,7 @@ private <O extends ObjectType> TaskRunResult runInternal(Task task) {
LOGGER.trace("Using object query from the task: {}", query.debugDump());
}
} catch (SchemaException ex) {
LOGGER.error("Schema error while creating a search filter: {}", new Object[]{ex.getMessage(), ex});
LOGGER.error("Schema error while creating a search filter: {}-{}", new Object[]{ex.getMessage(), ex});
opResult.recordFatalError("Schema error while creating a search filter: " + ex.getMessage(), ex);
runResult.setRunResultStatus(TaskRunResultStatus.PERMANENT_ERROR);
return runResult;
Expand Down Expand Up @@ -244,7 +244,7 @@ && isTrue(((ShadowType)(object.asObjectable())).isProtectedObject())) {
runResult.setRunResultStatus(TaskRunResultStatus.PERMANENT_ERROR);
return runResult;
} catch (CommunicationException e) {
LOGGER.error("{}", new Object[]{e.getMessage(), e});
LOGGER.error("{}-{}", new Object[]{e.getMessage(), e});
opResult.recordFatalError("Object not found " + e.getMessage(), e);
runResult.setRunResultStatus(TaskRunResultStatus.TEMPORARY_ERROR);
return runResult;
Expand Down
Expand Up @@ -176,7 +176,7 @@ public void notifyFailure(ResourceOperationDescription failureDescription,
try {
listener.notifyFailure(failureDescription, task, parentResult);
} catch (RuntimeException e) {
LOGGER.error("Exception {} thrown by operation failure listener {}: {}", new Object[]{
LOGGER.error("Exception {} thrown by operation failure listener {}: {}-{}", new Object[]{
e.getClass(), listener.getName(), e.getMessage(), e });
parentResult.createSubresult(CLASS_NAME_WITH_DOT + "notifyFailure").recordWarning("Operation failure listener has thrown unexpected exception", e);
}
Expand Down Expand Up @@ -206,7 +206,7 @@ public void notifySuccess(ResourceOperationDescription failureDescription,
try {
listener.notifySuccess(failureDescription, task, parentResult);
} catch (RuntimeException e) {
LOGGER.error("Exception {} thrown by operation success listener {}: {}", new Object[]{
LOGGER.error("Exception {} thrown by operation success listener {}: {}-{}", new Object[]{
e.getClass(), listener.getName(), e.getMessage(), e });
parentResult.createSubresult(CLASS_NAME_WITH_DOT + "notifySuccess").recordWarning("Operation success listener has thrown unexpected exception", e);
}
Expand Down Expand Up @@ -236,7 +236,7 @@ public void notifyInProgress(ResourceOperationDescription failureDescription,
try {
listener.notifyInProgress(failureDescription, task, parentResult);
} catch (RuntimeException e) {
LOGGER.error("Exception {} thrown by operation in-progress listener {}: {}", new Object[]{
LOGGER.error("Exception {} thrown by operation in-progress listener {}: {}-{}", new Object[]{
e.getClass(), listener.getName(), e.getMessage(), e });
parentResult.createSubresult(CLASS_NAME_WITH_DOT + "notifyInProgress").recordWarning("Operation in-progress listener has thrown unexpected exception", e);
}
Expand Down Expand Up @@ -279,7 +279,7 @@ public void notifyEvent(ResourceEventDescription eventDescription,
try {
listener.notifyEvent(eventDescription, task, parentResult);
} catch (RuntimeException e) {
LOGGER.error("Exception {} thrown by event listener {}: {}", new Object[]{
LOGGER.error("Exception {} thrown by event listener {}: {}-{}", new Object[]{
e.getClass(), listener.getName(), e.getMessage(), e });
parentResult.createSubresult(CLASS_NAME_WITH_DOT + "notifyEvent").recordWarning("Event listener has thrown unexpected exception", e);
throw e;
Expand Down

0 comments on commit c707b35

Please sign in to comment.