com.evolveum.midpoint.util.logging.Trace.error()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中com.evolveum.midpoint.util.logging.Trace.error()方法的一些代码示例,展示了Trace.error()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Trace.error()方法的具体详情如下:
包路径:com.evolveum.midpoint.util.logging.Trace
类名称:Trace
方法名:error

Trace.error介绍

暂无

代码示例

代码示例来源:origin: Evolveum/midpoint

private void logAndShowStopBanner(String additionalMessage) {
    String message = "\n\n*******************************************************************************" +
        "\n***                                                                         ***" +
        "\n***       Couldn't start midPoint because of a database schema issue.       ***" +
        "\n***                                                                         ***" +
        "\n*******************************************************************************\n" +
        (additionalMessage != null ? "\n" + additionalMessage + "\n\n" : "");
    LOGGER.error("{}", message);
    System.err.println(message);
  }
}

代码示例来源:origin: Evolveum/midpoint

public static boolean copyFile(InputStream srcStream, String srcName, File dstFile) {
  OutputStream dstStream = null;
  try {
    dstStream = new FileOutputStream(dstFile);
  } catch (FileNotFoundException e) {
    LOGGER.error("Unable to open destination file " + dstFile + ":", e);
    return false;
  }
  return copyFile(srcStream, srcName, dstStream, dstFile.toString());
}

代码示例来源:origin: Evolveum/midpoint

private String getFactoryClassName(Configuration config) {
  String className = config.getString(REPOSITORY_FACTORY_CLASS);
  if (StringUtils.isEmpty(className)) {
    LOGGER.error("RepositoryServiceFactory implementation class name ({}) not found in configuration. " +
        "Provided configuration:\n{}", new Object[]{REPOSITORY_FACTORY_CLASS, config});
    throw new SystemException("RepositoryServiceFactory implementation class name (" + REPOSITORY_FACTORY_CLASS
        + ") not found in configuration. Provided configuration:\n" + config);
  }
  return className;
}

代码示例来源:origin: Evolveum/midpoint

public static boolean copyFile(InputStream srcStream, String srcName, String dstPath) {
  OutputStream dstStream = null;
  try {
    dstStream = new FileOutputStream(dstPath);
  } catch (FileNotFoundException e) {
    LOGGER.error("Unable to open destination file " + dstPath + ":", e);
    return false;
  }
  return copyFile(srcStream, srcName, dstStream, dstPath);
}

代码示例来源:origin: Evolveum/midpoint

private String getFactoryClassName(Configuration config) {
  String className = config.getString(CONF_AUDIT_SERVICE_FACTORY);
  if (StringUtils.isEmpty(className)) {
    LOGGER.error("AuditServiceFactory implementation class name ({}) not found in configuration. " +
        "Provided configuration:\n{}", new Object[]{CONF_AUDIT_SERVICE_FACTORY, config});
    throw new SystemException("AuditServiceFactory implementation class name ("
        + CONF_AUDIT_SERVICE_FACTORY + ") not found in configuration. Provided configuration:\n"
        + config);
  }
  return className;
}

代码示例来源:origin: Evolveum/midpoint

private void print(String header, SAXParseException e) {
  StringBuilder builder = new StringBuilder();
  builder.append("Error occured during schema parsing: ");
  builder.append(header);
  builder.append(" ");
  builder.append(MessageFormat.format("on line {0} at {1}, {2}",
      new Object[] { Integer.toString(e.getLineNumber()), e.getSystemId(), e.getPublicId() }));
  builder.append(" ");
  builder.append(e.getMessage());
  LOGGER.error(builder.toString());
  LOGGER.trace(builder.toString(), e);
}

代码示例来源:origin: Evolveum/midpoint

private void processErrorPartial(TaskRunResult runResult, String errorDesc, Exception ex,
    TaskRunResultStatus runResultStatus, OperationResult opResult) {
  String message;
  if (ex == null) {
    message = errorDesc;
  } else {
    message = errorDesc+": "+ex.getMessage();
  }
  LOGGER.error("Reconciliation: {}-{}", new Object[]{message, ex});
  opResult.recordFatalError(message, ex);
  runResult.setRunResultStatus(runResultStatus);
}

代码示例来源:origin: Evolveum/midpoint

protected void assertNoShadow(String username, PrismObject<ResourceType> resource,
    Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException {
  ObjectQuery query = createAccountShadowQuery(username, resource);
  List<PrismObject<ShadowType>> accounts = repositoryService.searchObjects(ShadowType.class, query, null, result);
  if (accounts.isEmpty()) {
    return;
  }
  LOGGER.error("Found shadow for "+username+" on "+resource+" while not expecting it:\n"+accounts.get(0).debugDump());
  assert false : "Found shadow for "+username+" on "+resource+" while not expecting it: "+accounts;
}

代码示例来源:origin: Evolveum/midpoint

protected void failAllow(String action, Class<?> type, String desc, SecurityViolationException e) throws SecurityViolationException {
  String msg = "Failed to allow "+action+" of "+type.getSimpleName()+":"+desc;
  System.out.println(LOG_PREFIX_FAIL+msg);
  LOGGER.error(LOG_PREFIX_FAIL+msg);
  if (e != null) {
    throw new SecurityViolationException(msg+": "+e.getMessage(), e);
  } else {
    AssertJUnit.fail(msg);
  }
}

代码示例来源:origin: Evolveum/midpoint

@Override
public void refreshPrincipal(String oid) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
  try {
    MidPointPrincipal principal = userProfileService.getPrincipalByOid(oid);
    securityContextManager.setupPreAuthenticatedSecurityContext(principal);
  } catch (Throwable e) {
    LOGGER.error("Cannot refresh authentication for user identified with" + oid);
    throw e;
  }
}

代码示例来源:origin: Evolveum/midpoint

protected <O extends ObjectType> void failAllow(String action, SecurityViolationException e) throws SecurityViolationException {
  String msg = "Failed to allow "+action;
  System.out.println(LOG_PREFIX_FAIL+msg);
  LOGGER.error(LOG_PREFIX_FAIL+msg);
  if (e != null) {
    throw new SecurityViolationException(msg+": "+e.getMessage(), e);
  } else {
    AssertJUnit.fail(msg);
  }
}

代码示例来源:origin: Evolveum/midpoint

public static void assertFailure(OperationResult result) {
  if (!result.isError()) {
    String message = "Expected that operation "+result.getOperation()+" fails, but the result was "+result.getStatus();
    System.out.println(message);
    System.out.println(result.debugDump());
    LOGGER.error("{}",message);
    LOGGER.error("{}",result.debugDump());
    AssertJUnit.fail(message);
  }
  assertNoUnknown(result);
}

代码示例来源:origin: Evolveum/midpoint

private TaskRunResult logErrorAndSetResult(TaskRunResult runResult, AuditResultHandler resultHandler,
    String message, Throwable e, OperationResultStatus opStatus, TaskRunResultStatus status) {
  LOGGER.error("{}: {}: {}", taskName, message, e.getMessage(), e);
  runResult.getOperationResult().recordStatus(opStatus, message + ": " + e.getMessage(), e);
  runResult.setRunResultStatus(status);
  runResult.setProgress((long) resultHandler.getProgress());
  return runResult;
}

代码示例来源:origin: Evolveum/midpoint

private Thread executeInNewThread(final String threadName, final FailableRunnable runnable) {
  Thread t = new Thread(() -> {
      try {
        login(userAdministrator);
        runnable.run();
      } catch (Throwable e) {
        LOGGER.error("Error in {}: {}", threadName, e.getMessage(), e);
      }
    });
  t.setName(threadName);
  t.start();
  return t;
}

代码示例来源:origin: Evolveum/midpoint

public String resolveRefName(ObjectReferenceType ref) {
  if (ref == null) {
    return null;
  }
  PrismReferenceValue refValue = ref.asReferenceValue();
  Object name = refValue.getTargetName() != null ? ref.getTargetName().getOrig() : null;
  if (!(name instanceof String)) {
    LOGGER.error("Couldn't resolve object name");
  }
  return (String) name;
}

代码示例来源:origin: Evolveum/midpoint

@Override
  public void timeout() {
    try {
      Task freshTask = taskManager.getTaskWithResult(taskOid, waitResult);
      OperationResult result = freshTask.getResult();
      LOGGER.debug("Result of timed-out task:\n{}", result.debugDump());
      assert false : "Timeout ("+timeout+") while waiting for "+freshTask+" to start. Last result "+result;
    } catch (ObjectNotFoundException | SchemaException e) {
      LOGGER.error("Exception during task refresh: {}", e, e);
    }
  }
};

代码示例来源:origin: Evolveum/midpoint

private void fail(String message, OperationResult result) {
  System.out.println(message);
  result.recordFatalError(message);
  LOGGER.error("Repository self-test assertion failed: {}", message);
  AssertJUnit.fail(message);
}

代码示例来源:origin: Evolveum/midpoint

private void logAllLevels(Trace logger, String subsystemName) {
  String message = MARKER+" "+subsystemName;
  String previousSubsystem = MidpointInterceptor.swapSubsystemMark(subsystemName);
  logger.trace(message);
  logger.debug(message);
  logger.info(message);
  logger.warn(message);
  logger.error(message);
  MidpointInterceptor.swapSubsystemMark(previousSubsystem);
}

代码示例来源:origin: Evolveum/midpoint

private void validateAfterScript(String type) {
  try {
    new SchemaValidator().validate(MetadataExtractorIntegrator.getMetadata());
  } catch (org.hibernate.tool.schema.spi.SchemaManagementException e) {
    logAndShowStopBanner("The following problem is present even after running the " + type + " script: " + e.getMessage());
    LOGGER.error("Exception details", e);
    throw new SystemException("DB schema is not OK even after running the " + type + " script: " + e.getMessage(), e);
  }
}

代码示例来源:origin: Evolveum/midpoint

private void assertSubordinate(boolean expected, String upperOrgOid, String... lowerObjectOids) throws SchemaException {
  Collection<String> lowerObjectOidCol = Arrays.asList(lowerObjectOids);
  LOGGER.debug("=======> {}: {}", upperOrgOid, lowerObjectOidCol);
  boolean actual = repositoryService.isAnySubordinate(upperOrgOid, lowerObjectOidCol);
  if (expected != actual) {
    LOGGER.error("=======X {}: {}; expected={}, actual={}", new Object[]{upperOrgOid, lowerObjectOidCol, expected, actual});
    assertEquals("Wrong subordinate match: " + upperOrgOid + " to " + lowerObjectOidCol, expected, actual);
  } else {
    LOGGER.debug("=======O {}: {}; got={}", new Object[]{upperOrgOid, lowerObjectOidCol, expected});
  }
}

相关文章