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

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

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

LogManager.isMessageToBeRecorded介绍

[英]Utility method to identify whether a log message with the specified context and level will be recorded in the LogManager's destinations.
[中]实用程序方法,用于标识具有指定上下文和级别的日志消息是否将记录在LogManager的目标中。

代码示例

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

public AnalysisRecord(boolean recordQueryPlan, boolean recordDebug) {
  this.recordQueryPlan = recordQueryPlan || LogManager.isMessageToBeRecorded(LogConstants.CTX_QUERY_PLANNER, MessageLevel.DETAIL);
  this.recordDebug = recordDebug || LogManager.isMessageToBeRecorded(LogConstants.CTX_QUERY_PLANNER, MessageLevel.TRACE);
  
  if(this.recordQueryPlan) {
    this.annotations = new ArrayList<Annotation>();
  }
  
  if(this.recordDebug) {
    this.stringWriter = new StringWriter();
    this.debugWriter = new PrintWriter(this.stringWriter); 
  }
}

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

public static BlockedException block(Object... msg) {
  if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
    LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, msg); 
  }
  return INSTANCE;
}

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

private static void logMessage(int level, String context, Object msgPart, Object msgPart1) {
  if (msgPart == null || !isMessageToBeRecorded(context, level)) {
    return;
  } 
  logListener.log(level, context, msgPart, msgPart1);
}

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

private static void logMessage(int level, String context, Object msgPart) {
  if (msgPart == null || !isMessageToBeRecorded(context, level)) {
    return;
  } 
  logListener.log(level, context, msgPart);
}

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

public static BlockedException block(Object... msg) {
  if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
    LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, msg); 
  }
  return INSTANCE;
}

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

private void logRequest(Set<String> resources, Context context) {
  if (LogManager.isMessageToBeRecorded(LogConstants.CTX_AUDITLOGGING, MessageLevel.DETAIL)) {
    // Audit - request
    AuditMessage msg = new AuditMessage(context.name(), "getInaccessibleResources-request", resources.toArray(new String[resources.size()]), commandContext); //$NON-NLS-1$
    LogManager.logDetail(LogConstants.CTX_AUDITLOGGING, msg);
  }
}

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

public ThreadCpuTimer() {
  active = threadMXBean.isThreadCpuTimeSupported() 
      && threadMXBean.isThreadCpuTimeEnabled()
      && LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING, MessageLevel.DETAIL);
}

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

private void freeDataBlock(int dataBlock) {
  if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.TRACE)) {
    LogManager.logTrace(LogConstants.CTX_BUFFER_MGR, "freeing data block", dataBlock, "for", gid, oid); //$NON-NLS-1$ //$NON-NLS-2$
  }
  blocksInuse.clear(dataBlock);
}

代码示例来源:origin: org.teiid.connectors/translator-salesforce

private void logFields(String sObjectName, List<XmlObject> fields) {
  if (!LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.DETAIL)) {
    return;
  }
  LogManager.logDetail(LogConstants.CTX_CONNECTOR, "SalesForce Object Name = " + sObjectName); //$NON-NLS-1$
  LogManager.logDetail(LogConstants.CTX_CONNECTOR, "FieldCount = " + fields.size()); //$NON-NLS-1$
  for(int i = 0; i < fields.size(); i++) {
    XmlObject element = fields.get(i);
    LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Field # " + i + " is " + element.getName().getLocalPart()); //$NON-NLS-1$ //$NON-NLS-2$
  }
  
}

代码示例来源: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.jboss.teiid/teiid-engine

public void remove() {
  if (!removed) {
    if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
      LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, "Removing TupleBuffer:", this.tupleSourceID); //$NON-NLS-1$
    }
    this.batchBuffer = null;
    purge();
    this.manager.remove();
    removed = true;
  }
}

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

private TupleBuffer createTupleBuffer() throws TeiidComponentException {
  TupleBuffer tb = bufferManager.createTupleBuffer(this.schema, this.groupName, TupleSourceType.PROCESSOR);
  if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
    LogManager.logDetail(LogConstants.CTX_DQP, "Created intermediate sort buffer", tb); //$NON-NLS-1$
  }
  tb.setForwardOnly(true);
  return tb;
}

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

public void remove() {
  if (!removed) {
    if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
      LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, "Removing TupleBuffer:", this.tupleSourceID); //$NON-NLS-1$
    }
    this.batchBuffer = null;
    purge();
    this.manager.remove();
    removed = true;
  }
}

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

public void remove() {
  if (!removed) {
    if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
      LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, "Removing TupleBuffer:", this.tupleSourceID); //$NON-NLS-1$
    }
    this.batchBuffer = null;
    purge();
    this.manager.remove();
    removed = true;
  }
}

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

public void testIsMessageToBeRecordedString() {
  assertTrue(LogManager.isMessageToBeRecorded(CONTEXT, MessageLevel.CRITICAL) ); 
  
  ListLogger cfg = (ListLogger)LogManager.logListener;
  cfg.setLogLevel(CONTEXT, MessageLevel.NONE);
  assertFalse(LogManager.isMessageToBeRecorded(CONTEXT, MessageLevel.CRITICAL) );
}

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

int getAndSetNextClearBit(PhysicalInfo info) {
  int result = blocksInUse.getAndSetNextClearBit();
  if (result == -1) {
     throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30059, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30059, blockSize));
  }
  if (LogManager.isMessageToBeRecorded(LogConstants.CTX_BUFFER_MGR, MessageLevel.DETAIL)) {
    LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, "Allocating storage data block", result, "of size", blockSize, "to", info); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 
  }
  return result;
}

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

public ResultsFuture<ResultsMessage> processCursorRequest(long reqID,
    int batchFirst, int fetchSize) throws TeiidProcessingException {
  if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
    LogManager.logDetail(LogConstants.CTX_DQP, "DQP process cursor request", batchFirst, fetchSize);  //$NON-NLS-1$
  }
  DQPWorkContext workContext = DQPWorkContext.getWorkContext();
  ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>();
  RequestWorkItem workItem = getRequestWorkItem(workContext.getRequestID(reqID));
  workItem.requestMore(batchFirst, batchFirst + Math.min(fetchSize, this.config.getMaxRowsFetchSize()) - 1, resultsFuture.getResultsReceiver());
  return resultsFuture;
}

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

public ResultsFuture<ResultsMessage> processCursorRequest(long reqID,
    int batchFirst, int fetchSize) throws TeiidProcessingException {
  if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
    LogManager.logDetail(LogConstants.CTX_DQP, "DQP process cursor request", batchFirst, fetchSize);  //$NON-NLS-1$
  }
  DQPWorkContext workContext = DQPWorkContext.getWorkContext();
  ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>();
  RequestWorkItem workItem = getRequestWorkItem(workContext.getRequestID(reqID));
  workItem.requestMore(batchFirst, batchFirst + Math.min(fetchSize, this.config.getMaxRowsFetchSize()) - 1, resultsFuture.getResultsReceiver());
  return resultsFuture;
}

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

public ResultsFuture<LobChunk> requestNextLobChunk(int lobRequestId,
    long requestId, String streamId)
    throws TeiidProcessingException {
  if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
    LogManager.logDetail(LogConstants.CTX_DQP, "Request for next Lob chunk with Stream id="+streamId+" instance id="+lobRequestId);  //$NON-NLS-1$//$NON-NLS-2$
  }  
  RequestWorkItem workItem = getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(requestId));
  ResultsFuture<LobChunk> resultsFuture = new ResultsFuture<LobChunk>();
  workItem.processLobChunkRequest(streamId, lobRequestId, resultsFuture.getResultsReceiver());
  return resultsFuture;
}

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

public ResultsFuture<LobChunk> requestNextLobChunk(int lobRequestId,
    long requestId, String streamId)
    throws TeiidProcessingException {
  if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
    LogManager.logDetail(LogConstants.CTX_DQP, "Request for next Lob chunk with Stream id="+streamId+" instance id="+lobRequestId);  //$NON-NLS-1$//$NON-NLS-2$
  }  
  RequestWorkItem workItem = getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(requestId));
  ResultsFuture<LobChunk> resultsFuture = new ResultsFuture<LobChunk>();
  workItem.processLobChunkRequest(streamId, lobRequestId, resultsFuture.getResultsReceiver());
  return resultsFuture;
}

相关文章