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

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

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

Trace.isDebugEnabled介绍

暂无

代码示例

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

public static void logSecurityDeny(MidPointPrincipal midPointPrincipal, Object object, String message) {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Denied access to {} by {} {}", object, midPointPrincipal, message);
  }
}

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

public static <T> T javaLangClone(T orig) {
  try {
    Method cloneMethod = orig.getClass().getMethod("clone");
    Object clone = cloneMethod.invoke(orig);
    return (T) clone;
  } catch (NoSuchMethodException|IllegalAccessException|InvocationTargetException|RuntimeException e) {
    if (PERFORMANCE_ADVISOR.isDebugEnabled()) {
      PERFORMANCE_ADVISOR.debug("Error when cloning {}, will try serialization instead.", orig.getClass(), e);
    }
    return null;
  }
}

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

public static <O extends ObjectType> void logDelete(Class<O> type, String oid, OperationResult subResult) {
  if (!LOGGER_OP.isDebugEnabled()) {
    return;
  }
  LOGGER_OP.debug("{}-{} delete {}: {}", PREFIX, type.getSimpleName(), oid, getStatus(subResult));
}

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

private void traceOperation(String opName, long counter) {
  LOGGER.info("MONITOR dummy '{}' {} ({})", instanceName, opName, counter);
  if (LOGGER.isDebugEnabled()) {
    StackTraceElement[] fullStack = Thread.currentThread().getStackTrace();
    String immediateClass = null;
    String immediateMethod = null;
    StringBuilder sb = new StringBuilder();
    for (StackTraceElement stackElement: fullStack) {
      if (stackElement.getClassName().equals(DummyResource.class.getName()) ||
          stackElement.getClassName().equals(Thread.class.getName())) {
        // skip our own calls
        continue;
      }
      if (immediateClass == null) {
        immediateClass = stackElement.getClassName();
        immediateMethod = stackElement.getMethodName();
      }
      sb.append(stackElement.toString());
      sb.append("\n");
    }
    LOGGER.debug("MONITOR dummy '{}' {} ({}): {} {}", new Object[]{instanceName, opName, counter, immediateClass, immediateMethod});
    LOGGER.trace("MONITOR dummy '{}' {} ({}):\n{}", new Object[]{instanceName, opName, counter, sb});
  }
}

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

public static void logSecurityDeny(Object object, String message) {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Denied access to {} by {} {}", object, getSubjectDescription(), message);
  }
}

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

private void dumpConfiguration(String componentName, Configuration sub) {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Configuration for {} :", componentName);
    @SuppressWarnings("unchecked")
    Iterator<String> i = sub.getKeys();
    while (i.hasNext()) {
      String key = i.next();
      LOGGER.debug("    {} = {}", key, sub.getProperty(key));
    }
  }
}

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

public void resetOverride() {
  LOGGER.info("Clock override reset");
  this.override = null;
  this.overrideOffset = null;
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Clock current time: {}", currentTimeXMLGregorianCalendar());
  }
}

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

public static <O extends ObjectType> void logModify(Class<O> type, String oid, Collection<? extends ItemDelta> modifications,
    ModificationPrecondition<O> precondition, RepoModifyOptions options, OperationResult subResult) {
  if (!LOGGER_OP.isDebugEnabled()) {
    return;
  }
  LOGGER_OP.debug("{} modify {} {}{}{}: {}\n{}", PREFIX, type.getSimpleName(), oid,
      shortDumpOptions(options),
      precondition == null ? "" : " precondition="+precondition+", ",
      getStatus(subResult),
      DebugUtil.debugDump(modifications, 1, false));
}

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

public void override(long overrideTimestamp) {
  LOGGER.info("Clock override: {}", override);
  this.override = overrideTimestamp;
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Clock current time: {}", currentTimeXMLGregorianCalendar());
  }
}

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

private void recordFatalError(Exception e, XMLGregorianCalendar projectoStartTimestampCal, OperationResult result) {
  result.recordFatalError(e);
  result.cleanupResult(e);
  if (LOGGER.isDebugEnabled()) {
    long projectoStartTimestamp = XmlTypeConverter.toMillis(projectoStartTimestampCal);
    long projectorEndTimestamp = clock.currentTimeMillis();
    LOGGER.debug("Projector failed: {}. Etime: {} ms", e.getMessage(), (projectorEndTimestamp - projectoStartTimestamp));
  }
}

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

private void logApprovalActions(EvaluatedAssignment<?> newAssignment,
    List<EvaluatedPolicyRule> triggeredApprovalActionRules, PlusMinusZero plusMinusZero) {
  if (LOGGER.isDebugEnabled() && !triggeredApprovalActionRules.isEmpty()) {
    LOGGER.trace("-------------------------------------------------------------");
    String verb = plusMinusZero == PLUS ? "added" :
              plusMinusZero == MINUS ? "deleted" : "modified";
    LOGGER.debug("Assignment to be {}: {}: {} this target policy rules, {} triggered approval actions:",
        verb, newAssignment, newAssignment.getThisTargetPolicyRules().size(), triggeredApprovalActionRules.size());
    for (EvaluatedPolicyRule t : triggeredApprovalActionRules) {
      LOGGER.debug(" - Approval actions: {}", t.getEnabledActions(ApprovalPolicyActionType.class));
      for (EvaluatedPolicyRuleTrigger trigger : t.getTriggers()) {
        LOGGER.debug("   - {}", trigger);
      }
    }
  }
}

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

@Override
public void recordState(String message) {
  if (LOGGER.isTraceEnabled()) {
    LOGGER.trace("{}", message);
  }
  if (PERFORMANCE_ADVISOR.isDebugEnabled()) {
    PERFORMANCE_ADVISOR.debug("{}", message);
  }
  environmentalPerformanceInformation.recordState(message);
}

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

public static void logSecurityDeny(Object object, String message, Throwable cause, Collection<String> requiredAuthorizations) {
  if (LOGGER.isDebugEnabled()) {
    String subjectDesc = getSubjectDescription();
    LOGGER.debug("Denied access to {} by {} {}", object, subjectDesc, message);
    if (LOGGER.isTraceEnabled()) {
      LOGGER.trace("Denied access to {} by {} {}; one of the following authorization actions is required: "+requiredAuthorizations,
          object, subjectDesc, message, cause);
    }
  }
}

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

public static <O extends ObjectType> void logAdd(PrismObject<O> object, RepoAddOptions options, OperationResult subResult) {
  if (!LOGGER_OP.isDebugEnabled()) {
    return;
  }
  LOGGER_OP.debug("{} add {}{}: {}\n{}", PREFIX, object, shortDumpOptions(options), getStatus(subResult),
      object.debugDump(1));
}

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

private boolean processSchemaException(SchemaException e, XNodeImpl xsubnode, ParsingContext pc) throws SchemaException {
  if (pc.isStrict()) {
    throw e;
  } else {
    LoggingUtils.logException(LOGGER, "Couldn't parse part of the document. It will be ignored. Document part: {}", e, xsubnode);
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Part that couldn't be parsed:\n{}", xsubnode.debugDump());
    }
    pc.warn("Couldn't parse part of the document. It will be ignored. Document part:\n" + xsubnode);
    return true;
  }
}

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

private PipelineData executeAction(ActionExpressionType command, PipelineData input, ExecutionContext context, OperationResult globalResult) throws ScriptExecutionException {
  Validate.notNull(command, "command");
  Validate.notNull(command.getType(), "command.actionType");
  if (LOGGER.isTraceEnabled()) {
    LOGGER.trace("Executing action {} on {}", command.getType(), input.debugDump());
  } else if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Executing action {}", command.getType());
  }
  ActionExecutor executor = actionExecutors.get(command.getType());
  if (executor == null) {
    throw new IllegalStateException("Unsupported action type: " + command.getType());
  } else {
    PipelineData retval = executor.execute(command, input, context, globalResult);
    globalResult.setSummarizeSuccesses(true);
    globalResult.summarize();
    return retval;
  }
}

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

private void addModifyMetadataDeltas(PrismObject<ShadowType> repoShadow, Collection<ItemDelta> shadowChanges) {
    PropertyDelta<XMLGregorianCalendar> modifyTimestampDelta = ItemDeltaCollectionsUtil
        .findPropertyDelta(shadowChanges, SchemaConstants.PATH_METADATA_MODIFY_TIMESTAMP);
    if (modifyTimestampDelta != null) {
      return;
    }
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Metadata not found, adding minimal metadata. Modifications:\n{}", DebugUtil.debugDump(shadowChanges, 1));
    }
    PrismPropertyDefinition<XMLGregorianCalendar> def = repoShadow.getDefinition().findPropertyDefinition(SchemaConstants.PATH_METADATA_MODIFY_TIMESTAMP);
    modifyTimestampDelta = def.createEmptyDelta(SchemaConstants.PATH_METADATA_MODIFY_TIMESTAMP);
    modifyTimestampDelta.setRealValuesToReplace(clock.currentTimeXMLGregorianCalendar());
    shadowChanges.add(modifyTimestampDelta);
  }
}

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

public ClusterStatusInformation getClusterStatusInformation(boolean clusterwide, boolean allowCached, OperationResult parentResult) {
  OperationResult result = parentResult.createSubresult(ExecutionManager.class.getName() + ".getClusterStatusInformation");
  result.addParam("clusterwide", clusterwide);
  if (allowCached && clusterwide && lastClusterStatusInformation != null && lastClusterStatusInformation.isFresh(ALLOWED_CLUSTER_STATE_INFORMATION_AGE)) {
    result.recordSuccess();
    return lastClusterStatusInformation;
  }
  ClusterStatusInformation retval = new ClusterStatusInformation();
  if (clusterwide) {
    for (PrismObject<NodeType> node : taskManager.getClusterManager().getAllNodes(result)) {
      addNodeAndTaskInformation(retval, node, result);
    }
  } else {
    addNodeAndTaskInformation(retval, taskManager.getClusterManager().getLocalNodeObject(), result);
  }
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("cluster state information = {}", retval.dump());
  }
  if (clusterwide) {
    lastClusterStatusInformation = retval;
  }
  result.recomputeStatus();
  return retval;
}

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

public void prepareStartInstruction(WfTaskCreationInstruction instruction) {
  instruction.setProcessName(PROCESS_DEFINITION_KEY);
  instruction.setSimple(false);
  instruction.setSendStartConfirmation(true);
  instruction.setProcessInterfaceBean(this);
  if (LOGGER.isDebugEnabled() && instruction instanceof PcpChildWfTaskCreationInstruction) {
    PcpChildWfTaskCreationInstruction instr = (PcpChildWfTaskCreationInstruction) instruction;
    LOGGER.debug("About to start approval process instance '{}'", instr.getProcessInstanceName());
    if (instr.getProcessContent() instanceof ItemApprovalSpecificContent) {
      ItemApprovalSpecificContent iasc = (ItemApprovalSpecificContent) instr.getProcessContent();
      LOGGER.debug("Approval schema XML:\n{}", PrismUtil.serializeQuietlyLazily(prismContext, iasc.approvalSchemaType));
      LOGGER.debug("Attached rules:\n{}", PrismUtil.serializeQuietlyLazily(prismContext, iasc.policyRules));
    }
  }
}

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

public PrismObject<ResourceType> getResource(String oid, GetOperationOptions options, Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException{
  InternalMonitor.getResourceCacheStats().recordRequest();
  
  String version = repositoryService.getVersion(ResourceType.class, oid, parentResult);
  PrismObject<ResourceType> cachedResource = resourceCache.get(oid, version, options);
  if (cachedResource != null) {
    InternalMonitor.getResourceCacheStats().recordHit();
    if (LOGGER.isTraceEnabled()){
      LOGGER.trace("Returning resource from cache:\n{}", cachedResource.debugDump());
    }
    return cachedResource;
  }
  
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Fetching resource {}, version {}, storing to cache (previously cached version {})", 
        oid, version, resourceCache.getVersion(oid));
  }
  
  Collection<SelectorOptions<GetOperationOptions>> repoOptions = null;
  if (GetOperationOptions.isReadOnly(options)) {
    repoOptions = SelectorOptions.createCollection(GetOperationOptions.createReadOnly());
  }
  PrismObject<ResourceType> repositoryObject = readResourceFromRepository(oid, repoOptions, parentResult);
  
  return loadAndCacheResource(repositoryObject, options, task, parentResult);
}

相关文章