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

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

本文整理了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

  1. @Override
  2. public void run() {
  3. try {
  4. writeNotification(listenerId, notification, handback);
  5. } catch (IOException e) {
  6. log.warnf("Unable to send notification to listener %d", listenerId);
  7. }
  8. }
  9. });

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

  1. @Override
  2. public void run() {
  3. try {
  4. writeNotification(listenerId, notification, handback);
  5. } catch (IOException e) {
  6. log.warnf("Unable to send notification to listener %d", listenerId);
  7. }
  8. }
  9. });

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

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

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

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

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

  1. private void split(final String from, final Set<Byte> to) {
  2. String[] values = from.split(",");
  3. for (String current : values) {
  4. try {
  5. String temp = current.trim();
  6. if (temp.length() > 0) {
  7. to.add(Byte.valueOf(current.trim()));
  8. }
  9. } catch (NumberFormatException e) {
  10. log.warnf("Unrecognised version '%s' in list.", current);
  11. }
  12. }
  13. }

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

  1. @Override
  2. public void handleException(CommandAcceptanceException exception) {
  3. log.warnf(
  4. exception,
  5. "GenerationTarget encountered exception accepting command : %s",
  6. exception.getMessage()
  7. );
  8. }
  9. }

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

  1. ClientCommon(Channel channel, final Map<String, ?> environment) {
  2. super(channel);
  3. Integer seconds = null;
  4. if (environment != null && environment.containsKey(TIMEOUT_KEY)) {
  5. final Object timeout = environment.get(TIMEOUT_KEY);
  6. if (timeout instanceof Number) {
  7. seconds = ((Number) timeout).intValue();
  8. } else if (timeout instanceof String) {
  9. try {
  10. seconds = Integer.parseInt((String) timeout);
  11. } catch (NumberFormatException e) {
  12. log.warnf(e, "Could not parse configured timeout %s", timeout);
  13. }
  14. } else {
  15. log.warnf("Timeout %s configured via environment is not valid ", timeout);
  16. }
  17. } else {
  18. seconds = Integer.getInteger(TIMEOUT_KEY, DEFAULT_TIMEOUT);
  19. }
  20. timeoutSeconds = seconds == null ? DEFAULT_TIMEOUT : seconds;
  21. }

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

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

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

  1. private Set<Byte> getExcludedVersions() {
  2. Set<Byte> excluded = new HashSet<Byte>();
  3. Object list;
  4. if (environment != null && environment.containsKey(EXCLUDED_VERSIONS)
  5. && (list = environment.get(EXCLUDED_VERSIONS)) != null) {
  6. if (list instanceof String) {
  7. split((String) list, excluded);
  8. } else {
  9. log.warnf("Ignoring excluded versions list of type '%s'", list.getClass().getName());
  10. }
  11. }
  12. split(System.getProperty(EXCLUDED_VERSIONS, ""), excluded);
  13. return excluded;
  14. }

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

  1. @SuppressWarnings("ResultOfMethodCallIgnored")
  2. private static Reader toReader(File file, String charsetName) {
  3. if ( ! file.exists() ) {
  4. log.warnf( "Specified schema generation script file [%s] did not exist for reading", file );
  5. return new Reader() {
  6. @Override
  7. public int read(char[] cbuf, int off, int len) throws IOException {
  8. return -1;
  9. }
  10. @Override
  11. public void close() throws IOException {
  12. }
  13. };
  14. }
  15. try {
  16. return charsetName != null ?
  17. new InputStreamReader( new FileInputStream(file), charsetName ) :
  18. new InputStreamReader( new FileInputStream(file) );
  19. }
  20. catch (IOException e) {
  21. throw new SchemaManagementException(
  22. "Unable to open specified script target file [" + file + "] for reading",
  23. e
  24. );
  25. }
  26. }

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Finalize this closeable instance. If the instance hasn't been closed, it is closed and a warning is logged.
  3. */
  4. protected void finalize() throws Throwable {
  5. try {
  6. super.finalize();
  7. } finally {
  8. if (autoClose && isOpen()) {
  9. if (LEAK_DEBUGGING) {
  10. final Throwable t = new LeakThrowable();
  11. t.setStackTrace(backtrace);
  12. log.warnf(t, "Leaked a %s instance: %s", getClass().getName(), this);
  13. } else {
  14. log.tracef("Leaked a %s instance: %s", getClass().getName(), this);
  15. }
  16. closeAsync();
  17. }
  18. }
  19. }

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

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

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

  1. public VersionedConnection getVersionedConnection(final byte version, final Channel channel, final JMXServiceURL serviceURL)
  2. throws IOException {
  3. if (supportedVersions.containsKey(version)) {
  4. if (version == VersionOne.getVersionIdentifier()) {
  5. return VersionOne.getConnection(channel, environment);
  6. } else if (version == VersionTwo.getVersionIdentifier()) {
  7. return VersionTwo.getConnection(channel, environment, serviceURL);
  8. }
  9. } else {
  10. log.warnf("An attempt has been made to select an unsupported version 0x0%d", version);
  11. }
  12. throw new IllegalArgumentException("Unsupported protocol version.");
  13. }

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

  1. public void startServer(final byte version, final Channel channel, final MBeanServerManager serverManager,
  2. final Executor executor, final ServerMessageInterceptor serverMessageInterceptor) throws IOException {
  3. if (supportedVersions.containsKey(version)) {
  4. if (version == VersionOne.getVersionIdentifier()) {
  5. VersionOne.startServer(channel, serverManager.getDefaultMBeanServer(), executor, serverMessageInterceptor);
  6. } else if (version == VersionTwo.getVersionIdentifier()) {
  7. VersionTwo.startServer(channel, serverManager, executor, serverMessageInterceptor);
  8. }
  9. return;
  10. } else {
  11. log.warnf("An attempt has been made to select an unsupported version 0x0%d", version);
  12. }
  13. throw new IllegalArgumentException("Unsupported protocol version.");
  14. }
  15. }

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

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

相关文章