org.jboss.logging.Logger.warnf()方法的使用及代码示例

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

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

Logger.warnf介绍

[英]Issue a formatted log message with a level of WARN.
[中]发出带有警告级别的格式化日志消息。

代码示例

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

@Override
  public void run() {
    try {
      writeNotification(listenerId, notification, handback);
    } catch (IOException e) {
      log.warnf("Unable to send notification to listener %d", listenerId);
    }
  }
});

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

@Override
  public void run() {
    try {
      writeNotification(listenerId, notification, handback);
    } catch (IOException e) {
      log.warnf("Unable to send notification to listener %d", listenerId);
    }
  }
});

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

@Override
public void warn(String msg, Object... args) {
  this.logger.warnf(msg, args);
}

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

private static void warnDeprecated(String usedProtocol, String recommendedProtocol) {
  log.warnf("The protocol '%s' is deprecated, instead you should use '%s'.", usedProtocol, recommendedProtocol);
}

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

private void split(final String from, final Set<Byte> to) {
  String[] values = from.split(",");
  for (String current : values) {
    try {
      String temp = current.trim();
      if (temp.length() > 0) {
        to.add(Byte.valueOf(current.trim()));
      }
    } catch (NumberFormatException e) {
      log.warnf("Unrecognised version '%s' in list.", current);
    }
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
  public void handleException(CommandAcceptanceException exception) {
    log.warnf(
        exception,
        "GenerationTarget encountered exception accepting command : %s",
        exception.getMessage()
    );
  }
}

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

ClientCommon(Channel channel, final Map<String, ?> environment) {
  super(channel);
  Integer seconds = null;
  if (environment != null && environment.containsKey(TIMEOUT_KEY)) {
    final Object timeout = environment.get(TIMEOUT_KEY);
    if (timeout instanceof Number) {
      seconds = ((Number) timeout).intValue();
    } else if (timeout instanceof String) {
      try {
        seconds = Integer.parseInt((String) timeout);
      } catch (NumberFormatException e) {
        log.warnf(e, "Could not parse configured timeout %s", timeout);
      }
    } else {
      log.warnf("Timeout %s configured via environment is not valid ", timeout);
    }
  } else {
    seconds = Integer.getInteger(TIMEOUT_KEY, DEFAULT_TIMEOUT);
  }
  timeoutSeconds = seconds == null ? DEFAULT_TIMEOUT : seconds;
}

代码示例来源:origin: hibernate/hibernate-orm

public void performBeforeClassCallbacks(Object target) {
  if ( SessionFactoryRegistry.INSTANCE.hasRegistrations() ) {
    log.warnf( "Open SessionFactory instances found prior to start of test class [%s]", testClass.getName() );
  }
  performCallbacks( beforeClassOnceMethods, target );
}

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

private Set<Byte> getExcludedVersions() {
  Set<Byte> excluded = new HashSet<Byte>();
  Object list;
  if (environment != null && environment.containsKey(EXCLUDED_VERSIONS)
      && (list = environment.get(EXCLUDED_VERSIONS)) != null) {
    if (list instanceof String) {
      split((String) list, excluded);
    } else {
      log.warnf("Ignoring excluded versions list of type '%s'", list.getClass().getName());
    }
  }
  split(System.getProperty(EXCLUDED_VERSIONS, ""), excluded);
  return excluded;
}

代码示例来源:origin: hibernate/hibernate-orm

@SuppressWarnings("ResultOfMethodCallIgnored")
private static Reader toReader(File file, String charsetName) {
  if ( ! file.exists() ) {
    log.warnf( "Specified schema generation script file [%s] did not exist for reading", file );
    return new Reader() {
      @Override
      public int read(char[] cbuf, int off, int len) throws IOException {
        return -1;
      }
      @Override
      public void close() throws IOException {
      }
    };
  }
  try {
    return charsetName != null ?
      new InputStreamReader( new FileInputStream(file), charsetName ) :
      new InputStreamReader( new FileInputStream(file) );
  }
  catch (IOException e) {
    throw new SchemaManagementException(
        "Unable to open specified script target file [" + file + "] for reading",
        e
    );
  }
}

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

private synchronized void removeNotificationListener(int listenerId) throws ListenerNotFoundException,
    InstanceNotFoundException, IOException {
  Association association = listeners.remove(listenerId);
  if (association != null) {
    server.getMBeanServerConnection().removeNotificationListener(association.name, association.listener,
        association.filter, association.handback);
  } else {
    log.warnf("Request to removeNotificationListener, listener with ID %d not found.", listenerId);
  }
}

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

private synchronized void removeNotificationListener(int listenerId) throws ListenerNotFoundException,
    InstanceNotFoundException, IOException {
  Association association = listeners.remove(listenerId);
  if (association != null) {
    server.getMBeanServerConnection().removeNotificationListener(association.name, association.listener,
        association.filter, association.handback);
  } else {
    log.warnf("Request to removeNotificationListener, listener with ID %d not found.", listenerId);
  }
}

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

seconds = Integer.parseInt((String) timeout);
} catch (NumberFormatException e) {
  log.warnf(e, "Could not parse configured timeout %s", timeout);
log.warnf("Timeout %s configured via environment is not valid ", timeout);

代码示例来源:origin: hibernate/hibernate-orm

public void performAfterClassCallbacks(Object target) {
  performCallbacks( afterClassOnceMethods, target );
  if ( SessionFactoryRegistry.INSTANCE.hasRegistrations() ) {
    log.warnf( "Open SessionFactory instances found after completion of test class [%s]; closing them", testClass.getName() );
    SessionFactoryRegistry.INSTANCE.clearRegistrations();
  }
}

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

private void notify(int id, Notification n, Object handback) {
  Association association = get(id);
  if (association != null) {
    association.listener.handleNotification(n, association.handBack);
  } else {
    // If an invalid ID is received don't throw an error, instead just send
    // a message to the server canceling the notification by id.
    try {
      log.warnf("Notification recieved for non existant NotificationListener %d", id);
      mbeanServerConnection.removeNotificationListener(new int[] { id });
    } catch (InstanceNotFoundException e) {
    } catch (ListenerNotFoundException e) {
    } catch (IOException e) {
    }
  }
}

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

/**
 * Finalize this closeable instance.  If the instance hasn't been closed, it is closed and a warning is logged.
 */
protected void finalize() throws Throwable {
  try {
    super.finalize();
  } finally {
    if (autoClose && isOpen()) {
      if (LEAK_DEBUGGING) {
        final Throwable t = new LeakThrowable();
        t.setStackTrace(backtrace);
        log.warnf(t, "Leaked a %s instance: %s", getClass().getName(), this);
      } else {
        log.tracef("Leaked a %s instance: %s", getClass().getName(), this);
      }
      closeAsync();
    }
  }
}

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

private void notify(int id, Notification n, Object handback) {
  Association association = get(id);
  if (association != null) {
    association.listener.handleNotification(n, handback);
  } else {
    // If an invalid ID is received don't throw an error, instead just send
    // a message to the server canceling the notification by id.
    try {
      log.warnf("Notification recieved for non existant NotificationListener %d", id);
      mbeanServerConnection.removeNotificationListener(new int[] { id });
    } catch (InstanceNotFoundException e) {
    } catch (ListenerNotFoundException e) {
    } catch (IOException e) {
    }
  }
}

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

public VersionedConnection getVersionedConnection(final byte version, final Channel channel, final JMXServiceURL serviceURL)
    throws IOException {
  if (supportedVersions.containsKey(version)) {
    if (version == VersionOne.getVersionIdentifier()) {
      return VersionOne.getConnection(channel, environment);
    } else if (version == VersionTwo.getVersionIdentifier()) {
      return VersionTwo.getConnection(channel, environment, serviceURL);
    }
  } else {
    log.warnf("An attempt has been made to select an unsupported version 0x0%d", version);
  }
  throw new IllegalArgumentException("Unsupported protocol version.");
}

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

public void startServer(final byte version, final Channel channel, final MBeanServerManager serverManager,
      final Executor executor, final ServerMessageInterceptor serverMessageInterceptor) throws IOException {
    if (supportedVersions.containsKey(version)) {
      if (version == VersionOne.getVersionIdentifier()) {
        VersionOne.startServer(channel, serverManager.getDefaultMBeanServer(), executor, serverMessageInterceptor);
      } else if (version == VersionTwo.getVersionIdentifier()) {
        VersionTwo.startServer(channel, serverManager, executor, serverMessageInterceptor);
      }
      return;
    } else {
      log.warnf("An attempt has been made to select an unsupported version 0x0%d", version);
    }
    throw new IllegalArgumentException("Unsupported protocol version.");
  }
}

代码示例来源:origin: org.jboss.remotingjmx/remoting-jmx

private synchronized void removeNotificationListener(int listenerId) throws ListenerNotFoundException,
    InstanceNotFoundException, IOException {
  Association association = listeners.remove(listenerId);
  if (association != null) {
    server.getMBeanServerConnection().removeNotificationListener(association.name, association.listener,
        association.filter, association.handback);
  } else {
    log.warnf("Request to removeNotificationListener, listener with ID %d not found.", listenerId);
  }
}

相关文章