flex.messaging.log.Logger类的使用及代码示例

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

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

Logger介绍

[英]The Logger class is used to log out information. It provides named methods to log information out at the desired level. Each Logger will log information out for a log category that is settable.
[中]Logger类用于注销信息。它提供命名方法以在所需级别注销信息。每个Logger将注销可设置日志类别的信息。

代码示例

代码示例来源:origin: org.apache.flex.blazeds/flex-messaging-core

private void reportStatusIfDebug(String message)
{
  String threadName = Thread.currentThread().getName();
  if (Log.isDebug())
    Log.getLogger(FLEX_CLIENT_LOG_CATEGORY).debug("Poll wait thread '" + threadName + "' for FlexClient with id '" + this.id + "' is " + message);
}

代码示例来源:origin: org.apache.flex.blazeds/flex-messaging-core

/**
 * Adds the channel id to the list of default channel ids.
 *
 * @param id The id of the channel to add to the list of default channel ids.
 */
public void addDefaultChannel(String id)
{
  if (defaultChannels == null)
    defaultChannels = new ArrayList<String>();
  else if (defaultChannels.contains(id))
    return;
  List<String> channelIds = getChannelIds();
  if (channelIds == null || !channelIds.contains(id))
  {
    // No channel with id ''{0}'' is known by the MessageBroker.
    if (Log.isWarn())
    {
      Log.getLogger(LOG_CATEGORY).warn("No channel with id '{0}' is known by the MessageBroker." +
          " Not adding the channel.",
          new Object[]{id});
    }
    return;
  }
  defaultChannels.add(id);
}

代码示例来源:origin: com.adobe.flex/com.springsource.flex.messaging

/**
 * Receive the next message from the underlying MessageConsumer or wait
 * indefinetely until a message arrives if there is no message.
 *
 * @return The received JMS message.
 * @throws JMSException The thrown JMS exception.
 */
public Message receive() throws JMSException
{
  if (Log.isInfo())
    Log.getLogger(JMSAdapter.LOG_CATEGORY).info(Thread.currentThread()
        + " JMS consumer for JMS destination '" + destinationJndiName
        + "' is waiting forever until a new message arrives.");
  return consumer.receive();
}

代码示例来源:origin: com.adobe.flex/com.springsource.flex.messaging

/**
 * @exclude
 * Removes a subscription from the subscription set for this MessageClient.
 * 
 * @param selector The selector expression for the subscription.
 * @param subtopic The subtopic for the subscription.
 * @return true if no subscriptions remain for this MessageClient; otherwise false.
 */
public boolean removeSubscription(String selector, String subtopic)
{
  synchronized (lock)
  {
    if (subscriptions.remove(new SubscriptionInfo(selector, subtopic)))
      return decrementReferences();
    else if (Log.isError())
      Log.getLogger(MessageService.LOG_CATEGORY).error("Error - unable to find subscription to remove for MessageClient: " + clientId + " selector: " + selector + " subtopic: " + subtopic);
    return numReferences == 0;            
  }
}

代码示例来源:origin: com.adobe.flex/com.springsource.flex.messaging

/**
 * Stops the <code>JMSProducer</code> by closing its underlying
 * <code>MessageProducer</code>. It then calls <code>JMSProxy.close</code>
 * for session and connection closure.
 */
public void stop()
{
  if (Log.isInfo())
    Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS producer for JMS destination '" +
        destinationJndiName + "' is stopping.");
  try
  {
    if (producer != null)
      producer.close();
  }
  catch (JMSException e)
  {
    if (Log.isWarn())
      Log.getLogger(JMSAdapter.LOG_CATEGORY).warn("JMS producer for JMS destination '" +
          destinationJndiName + "' received an error while closing"
          + " its underlying MessageProducer: " + e.getMessage());
  }
  super.stop();
}

代码示例来源:origin: com.adobe.flex/com.springsource.flex.messaging

/**
 * This is called remotely from other cluster members when a new remote subscription is identified.
 *
 * We add or remove a remote subscription...
 */
public void subscribeFromPeer(String destinationId, Boolean subscribe, String selector, String subtopic, Object remoteAddress)
{
  Destination destination = getDestination(destinationId);
  RemoteSubscriptionManager subMgr = ((MessageDestination) destination).getRemoteSubscriptionManager();
  if (destination instanceof MessageDestination)
  {
    if (Log.isDebug())
      Log.getLogger(MessageService.LOG_CATEGORY).debug("Received subscription from peer: " + remoteAddress + " subscribe? " + subscribe + " selector: " + selector + " subtopic: " + subtopic);
    if (subscribe.booleanValue())
      subMgr.addSubscriber(remoteAddress, selector, subtopic, null);
    else
      subMgr.removeSubscriber(remoteAddress, selector, subtopic, null);
  }
  else if (Log.isError())
    Log.getLogger(LOG_CATEGORY).error("subscribeFromPeer called with destination: " + destinationId + " that is not a MessageDestination");
}

代码示例来源:origin: spring-projects/spring-flex

public void logEvent(LogEvent logevent) {
  String category = logevent.logger.getCategory();
  if (this.categoryPrefix != null) {
    category = this.categoryPrefix + "." + category;

代码示例来源:origin: org.apache.flex.blazeds/flex-messaging-common

/**
 * Given a category, returns the logger associated with the category.
 *
 * @param category Categogry for the logger.
 * @return Logger associated with the category.
 */
public static Logger getLogger(String category)
{
  if (log != null)
    return getLogger(log, category);
  // Return a dummy logger?
  return new Logger(category);
}

代码示例来源:origin: com.adobe.blazeds/blazeds-common

/**
 * Sets up this target with the specified logger.
 * This allows this target to receive log events from the specified logger.
 *
 * @param logger this target should listen to.
 */
public void addLogger(Logger logger)
{
  if (logger != null)
  {
    synchronized (lock)
    {
      loggerCount++;
    }
    logger.addTarget(this);
  }
}

代码示例来源:origin: com.adobe.blazeds/blazeds-opt

public void workRejected(WorkEvent event) 
{
  WorkException e = event.getException();
  if (Log.isDebug())
    Log.getLogger(LogCategories.EXECUTOR).error("AsynchBeansWorkManager's WorkListener.workRejected() callback invoked. WorkException? " + e);
  
  handleFailedExecution(((WorkCommandWrapper)event.getWork()).command, e);
}
public void workStarted(WorkEvent event)

代码示例来源:origin: org.apache.flex.blazeds/flex-messaging-core

/**
 * Stops the <code>JMSProducer</code> by closing its underlying
 * <code>MessageProducer</code>. It then calls <code>JMSProxy.close</code>
 * for session and connection closure.
 */
public void stop()
{
  if (Log.isInfo())
    Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS producer for JMS destination '" +
        destinationJndiName + "' is stopping.");
  try
  {
    if (producer != null)
      producer.close();
  }
  catch (JMSException e)
  {
    if (Log.isWarn())
      Log.getLogger(JMSAdapter.LOG_CATEGORY).warn("JMS producer for JMS destination '" +
          destinationJndiName + "' received an error while closing"
          + " its underlying MessageProducer: " + e.getMessage());
  }
  super.stop();
}

代码示例来源:origin: org.apache.flex.blazeds/flex-messaging-core

/**
 * This is called remotely from other cluster members when a new remote subscription is identified.
 *
 * We add or remove a remote subscription...
 * @param destinationId the destination ID
 * @param subscribe whehter it is a subscribe or unsubscribe
 * @param selector the selector string
 * @param subtopc the subtopic string
 * @param remoteAddress the remote node address in the cluster
 */
public void subscribeFromPeer(String destinationId, Boolean subscribe, String selector, String subtopic, Object remoteAddress)
{
  Destination destination = getDestination(destinationId);
  RemoteSubscriptionManager subMgr = ((MessageDestination) destination).getRemoteSubscriptionManager();
  if (destination instanceof MessageDestination)
  {
    if (debug)
      Log.getLogger(MessageService.LOG_CATEGORY).debug("Received subscription from peer: " + remoteAddress + " subscribe? " + subscribe + " selector: " + selector + " subtopic: " + subtopic);
    if (subscribe)
      subMgr.addSubscriber(remoteAddress, selector, subtopic, null);
    else
      subMgr.removeSubscriber(remoteAddress, selector, subtopic, null);
  }
  else if (Log.isError())
    Log.getLogger(LOG_CATEGORY).error("subscribeFromPeer called with destination: " + destinationId + " that is not a MessageDestination");
}

代码示例来源:origin: com.adobe.blazeds/blazeds-common

("[" + event.logger.getCategory() + "] ") : "";
String level = "";
if (includeLevel)

代码示例来源:origin: apache/flex-blazeds

/**
 * Given a category, returns the logger associated with the category.
 *
 * @param category Categogry for the logger.
 * @return Logger associated with the category.
 */
public static Logger getLogger(String category)
{
  if (log != null)
    return getLogger(log, category);
  // Return a dummy logger?
  return new Logger(category);
}

代码示例来源:origin: org.apache.flex.blazeds/flex-messaging-common

/**
 * Sets up this target with the specified logger.
 * This allows this target to receive log events from the specified logger.
 *
 * @param logger this target should listen to.
 */
public void addLogger(Logger logger)
{
  if (logger != null)
  {
    synchronized (lock)
    {
      loggerCount++;
    }
    logger.addTarget(this);
  }
}

代码示例来源:origin: com.adobe.blazeds/blazeds-opt

public void workCompleted(WorkEvent event) 
{
  // This only needs to be handled if execution of the Runnable failed.
  WorkException e = event.getException();
  if (e != null)
  {
    if (Log.isDebug())
      Log.getLogger(LogCategories.EXECUTOR).error("AsynchBeansWorkManager's WorkListener.workCompleted() callback invoked for failed execution.", e);
    
    handleFailedExecution(((WorkCommandWrapper)event.getWork()).command, e);
  }
}
public void workRejected(WorkEvent event)

代码示例来源:origin: apache/flex-blazeds

private void reportStatusIfDebug(String message)
{
  String threadName = Thread.currentThread().getName();
  if (Log.isDebug())
    Log.getLogger(FLEX_CLIENT_LOG_CATEGORY).debug("Poll wait thread '" + threadName + "' for FlexClient with id '" + this.id + "' is " + message);
}

代码示例来源:origin: com.adobe.flex/com.springsource.flex.messaging

/**
 * Adds the channel id to the list of default channel ids.
 *
 * @param id The id of the channel to add to the list of default channel ids.
 */
public void addDefaultChannel(String id)
{
  if (defaultChannels == null)
    defaultChannels = new ArrayList();
  else if (defaultChannels.contains(id))
    return;
  List channelIds = getChannelIds();
  if (channelIds == null || !channelIds.contains(id))
  {
    // No channel with id ''{0}'' is known by the MessageBroker.
    if (Log.isWarn())
    {
      Log.getLogger(LOG_CATEGORY).warn("No channel with id '{0}' is known by the MessageBroker." +
          " Not adding the channel.",
          new Object[]{id});
    }
    return;
  }
  defaultChannels.add(id);
}

代码示例来源:origin: apache/flex-blazeds

/**
 * Stops the <code>JMSProducer</code> by closing its underlying
 * <code>MessageProducer</code>. It then calls <code>JMSProxy.close</code>
 * for session and connection closure.
 */
public void stop()
{
  if (Log.isInfo())
    Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS producer for JMS destination '" +
        destinationJndiName + "' is stopping.");
  try
  {
    if (producer != null)
      producer.close();
  }
  catch (JMSException e)
  {
    if (Log.isWarn())
      Log.getLogger(JMSAdapter.LOG_CATEGORY).warn("JMS producer for JMS destination '" +
          destinationJndiName + "' received an error while closing"
          + " its underlying MessageProducer: " + e.getMessage());
  }
  super.stop();
}

代码示例来源:origin: org.apache.flex.blazeds/flex-messaging-core

/**
 * Receive the next message from the underlying MessageConsumer or wait
 * indefinetely until a message arrives if there is no message.
 *
 * @return The received JMS message.
 * @throws JMSException The thrown JMS exception.
 */
public Message receive() throws JMSException
{
  if (Log.isInfo())
    Log.getLogger(JMSAdapter.LOG_CATEGORY).info(Thread.currentThread()
        + " JMS consumer for JMS destination '" + destinationJndiName
        + "' is waiting forever until a new message arrives.");
  return consumer.receive();
}

相关文章