org.teiid.logging.LogManager.log()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(143)

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

LogManager.log介绍

[英]Send a message of the specified level to the log.

Only if the log manager is configured to send such messages to the destination will the message be recorded.
[中]将指定级别的消息发送到日志。
只有将日志管理器配置为将此类消息发送到目标时,才会记录该消息。

代码示例

代码示例来源:origin: teiid/teiid

/**
 * Send a detail message to the log.  Such messages are moderately detailed,
 * and help to debug typical problems in the system.  Generally, these
 * messages are not so detailed that the big picture gets lost.
 * <p>
 * Only if the log manager is configured to send such messages to the
 * destination will the message be recorded.
 * @param context the context for this log message (for example, the component
 * that is generating this message).
 * @param e the exception that is to be logged; the message is
 * not logged if this parameter is null
 * @param message the log message (may be null)
 */
public static void logDetail(String context, Throwable e, Object ... message) {
  log(MessageLevel.DETAIL,context,e,message);
}

代码示例来源:origin: teiid/teiid

String debugLog = analysisRecord.getDebugLog();
if(debugLog != null && debugLog.length() > 0) {
  LogManager.log(requestMsg.getShowPlan()==ShowPlan.DEBUG?MessageLevel.INFO:MessageLevel.TRACE, LogConstants.CTX_QUERY_PLANNER, debugLog);

代码示例来源:origin: org.jboss.teiid/teiid-engine

String debugLog = analysisRecord.getDebugLog();
if(debugLog != null && debugLog.length() > 0) {
  LogManager.log(requestMsg.getShowPlan()==ShowPlan.DEBUG?MessageLevel.INFO:MessageLevel.TRACE, LogConstants.CTX_QUERY_PLANNER, debugLog);

代码示例来源:origin: teiid/teiid

/**
 * Send an error message to the log.  Error messages are generally used
 * to record unexpected problems, or errors that are not critical in nature
 * and from which the system can automatically recover.
 * <p>
 * Only if the log manager is configured to send such messages to the
 * destination will the message be recorded.
 * @param context the context for this log message (for example, the component
 * that is generating this message).
 * @param e the exception that is to be logged; the message is
 * not logged if this parameter is null
 * @param message the log message (may be null)
 */
public static void logError(String context, Throwable e, Object message) {
  log(MessageLevel.ERROR,context,e,message);
}

代码示例来源:origin: org.teiid/teiid-engine

String debugLog = analysisRecord.getDebugLog();
if(debugLog != null && debugLog.length() > 0) {
  LogManager.log(requestMsg.getShowPlan()==ShowPlan.DEBUG?MessageLevel.INFO:MessageLevel.TRACE, LogConstants.CTX_QUERY_PLANNER, debugLog);

代码示例来源:origin: teiid/teiid

/**
 * Send a warning message to the log.  Warning messages generally described
 * expected errors from which the system should recover.  However, this level
 * is used to record the fact that such an error or event did occur.
 * <p>
 * Only if the log manager is configured to send such messages to the
 * destination will the message be recorded.
 * @param context the context for this log message (for example, the component
 * that is generating this message).
 * @param e the exception that is to be logged; the message is
 * not logged if this parameter is null
 * @param message the log message (may be null)
 */
public static void logWarning(String context, Throwable e, Object message) {
  log(MessageLevel.WARNING,context,e,message);
}

代码示例来源:origin: teiid/teiid

/**
 * Send a critical message to the log.  This level of message is generally
 * used to record an event or error that must be recorded (if any logging
 * is used).  If it is used to record an error, it generally means that the
 * system encountered a critical error which affects the integrity, accuracy,
 * reliability and/or capability of the system.
 * <p>
 * Only if the log manager is configured to send such messages to the
 * destination will the message be recorded.
 * @param context the context for this log message (for example, the component
 * that is generating this message).
 * @param e the exception that is to be logged; the message is
 * not logged if this parameter is null
 * @param message the log message (may be null)
 */
public static void logCritical(String context, Throwable e, Object message) {
  log(MessageLevel.CRITICAL,context,e,message);
}

代码示例来源:origin: teiid/teiid

LogManager.log(level, loggingContext, message.toString());
  LogManager.log(level, loggingContext, 
    "after " + method.getName()+ " : "+result); //$NON-NLS-1$ //$NON-NLS-2$

代码示例来源:origin: org.jboss.teiid/teiid-engine

public void log(ValidatorReport report, ModelMetaData model, Severity severity, String msg) {
  model.addRuntimeMessage(severity, msg);
  int messageLevel = MessageLevel.WARNING;
  if (severity == Severity.ERROR) {
    report.handleValidationError(msg);
  } else {
    messageLevel = MessageLevel.INFO;
  }
  LogManager.log(messageLevel, LogConstants.CTX_QUERY_RESOLVER, msg);
}

代码示例来源:origin: org.teiid/teiid-engine

public void log(ValidatorReport report, ModelMetaData model, Severity severity, String msg) {
  model.addRuntimeMessage(severity, msg);
  int messageLevel = MessageLevel.WARNING;
  if (severity == Severity.ERROR) {
    report.handleValidationError(msg);
  } else {
    messageLevel = MessageLevel.INFO;
  }
  LogManager.log(messageLevel, LogConstants.CTX_QUERY_RESOLVER, msg);
}

代码示例来源:origin: teiid/teiid

public void log(ValidatorReport report, ModelMetaData model, Severity severity, String msg) {
  model.addRuntimeMessage(severity, msg);
  int messageLevel = MessageLevel.WARNING;
  if (severity == Severity.ERROR) {
    report.handleValidationError(msg);
  } else {
    messageLevel = MessageLevel.INFO;
  }
  LogManager.log(messageLevel, LogConstants.CTX_QUERY_RESOLVER, msg);
}

代码示例来源:origin: org.teiid/teiid-runtime

private void writeExceptionCaught(Channel channel,
    Throwable cause) {
  ChannelListener listener = this.listeners.get(channel);
  if (listener != null) {
    listener.exceptionOccurred(cause);
  } else {
    int level = SocketClientInstance.getLevel(cause);
    LogManager.log(level, LogConstants.CTX_TRANSPORT, LogManager.isMessageToBeRecorded(LogConstants.CTX_TRANSPORT, MessageLevel.DETAIL)||level<MessageLevel.WARNING?cause:null, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40114, cause.getMessage()));
    channel.close();
  }
}

代码示例来源:origin: org.teiid/teiid-runtime

@Override
public void exceptionOccurred(Throwable t) {
  int level = SocketClientInstance.getLevel(t);
  LogManager.log(level, LogConstants.CTX_TRANSPORT, LogManager.isMessageToBeRecorded(LogConstants.CTX_TRANSPORT, MessageLevel.DETAIL)||level<MessageLevel.WARNING?t:null, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40114, t.getMessage()));
  server.terminate();
}

代码示例来源:origin: org.teiid/teiid-olingo

LogManager.log(logLevel, LogConstants.CTX_ODATA, error.getException(), ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16050, error.getMessage(), ex.getMessage()));
} else {
  LogManager.log(logLevel, LogConstants.CTX_DQP, ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16051, error.getMessage(), ex.getMessage())); 		    		
  LogManager.log(logLevel, LogConstants.CTX_ODATA, error.getException(), ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16052, error.getMessage()));
} else {
  LogManager.log(logLevel, LogConstants.CTX_DQP, ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16053, error.getMessage()));

代码示例来源:origin: org.teiid/teiid-runtime

public void exceptionOccurred(Throwable t) {
  //Object encoding may fail, so send a specific type of message to indicate there was a problem
  if (objectSocket.isOpen() && !isClosedException(t)) {
    if (workContext.getClientVersion().compareTo(Version.EIGHT_4) >= 0 && t instanceof FailedWriteException) {
      FailedWriteException fwe = (FailedWriteException)t;
      if (fwe.getObject() instanceof Message) {
        Message m = (Message)fwe.getObject();
        if (!(m.getMessageKey() instanceof ExceptionHolder)) {
          Message exception = new Message();
          exception.setContents(m.getMessageKey());
          exception.setMessageKey(new ExceptionHolder(fwe.getCause()));
          objectSocket.write(exception);
          LogManager.log(getLevel(t), LogConstants.CTX_TRANSPORT, t, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40113)); 
          return;
        }
      }
    }
    if (workContext.getClientVersion().compareTo(Version.EIGHT_6) >= 0) {
      Message exception = new Message();
      exception.setMessageKey(new ExceptionHolder(t));
      objectSocket.write(exception);
      LogManager.log(getLevel(t), LogConstants.CTX_TRANSPORT, t, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40113)); 
      return;
    }
  }
  int level = getLevel(t);
  LogManager.log(level, LogConstants.CTX_TRANSPORT, LogManager.isMessageToBeRecorded(LogConstants.CTX_TRANSPORT, MessageLevel.DETAIL)||level<MessageLevel.WARNING?t:null, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40114, t.getMessage())); 
  objectSocket.close();
}

代码示例来源:origin: org.teiid/teiid-engine

LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING_SOURCE, message);

代码示例来源:origin: org.jboss.teiid/teiid-engine

void logMMCommand(RequestWorkItem workItem, Event status, Long rowCount, Long cpuTime) {
  if ((status != Event.PLAN && !LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING, MessageLevel.INFO))
      || (status == Event.PLAN && !LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING, MessageLevel.TRACE))) {
    return;
  }
  
  RequestMessage msg = workItem.requestMsg;
  DQPWorkContext workContext = DQPWorkContext.getWorkContext();
  RequestID rID = workItem.requestID;
  String txnID = null;
  TransactionContext tc = workItem.getTransactionContext();
  if (tc != null && tc.getTransactionType() != Scope.NONE) {
    txnID = tc.getTransactionId();
  }
  String appName = workContext.getAppName();
  // Log to request log
  CommandLogMessage message = null;
  if (status == Event.NEW) {
    message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getSessionId(), appName, workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), msg.getCommandString(), cpuTime);
  } else {
    QueryProcessor qp = workItem.getProcessor();
    PlanNode plan = null;
    if (LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING, MessageLevel.TRACE) && qp != null) {
      plan = qp.getProcessorPlan().getDescriptionProperties();
    }
    message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getSessionId(), workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), rowCount, status, plan);
  }
  LogManager.log(status == Event.PLAN?MessageLevel.TRACE:MessageLevel.INFO, LogConstants.CTX_COMMANDLOGGING, message);
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING, message);

代码示例来源:origin: teiid/teiid

LogManager.log(status == Event.PLAN?MessageLevel.TRACE:MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING, message);

代码示例来源:origin: org.teiid/teiid-engine

LogManager.log(status == Event.PLAN?MessageLevel.TRACE:MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING, message);

相关文章