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

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

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

Logger.warn介绍

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

代码示例

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

  1. @Override
  2. protected final void doTask(Runnable task) {
  3. try {
  4. task.run();
  5. } catch (ActiveMQInterruptedException e) {
  6. // This could happen during shutdowns. Nothing to be concerned about here
  7. logger.debug("Interrupted Thread", e);
  8. } catch (Throwable t) {
  9. logger.warn(t.getMessage(), t);
  10. }
  11. }

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

  1. public static void debugFrame(Logger logger, String message, ByteBuf byteIn) {
  2. if (logger.isTraceEnabled()) {
  3. int location = byteIn.readerIndex();
  4. // debugging
  5. byte[] frame = new byte[byteIn.writerIndex()];
  6. byteIn.readBytes(frame);
  7. try {
  8. logger.trace(message + "\n" + ByteUtil.formatGroup(ByteUtil.bytesToHex(frame), 8, 16));
  9. } catch (Exception e) {
  10. logger.warn(e.getMessage(), e);
  11. }
  12. byteIn.readerIndex(location);
  13. }
  14. }

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

  1. public static void inTransaction(SessionImplementor session, Consumer<SessionImplementor> action) {
  2. log.trace( "inTransaction(session,action)" );
  3. log.trace( "Started transaction" );
  4. log.trace( "Calling action in txn" );
  5. action.accept( session );
  6. log.trace( "Called action - in txn" );
  7. log.warn( ACTION_COMPLETED_TXN, e );

代码示例来源:origin: looly/hutool

  1. @Override
  2. public void log(String fqcn, Level level, Throwable t, String format, Object... arguments) {
  3. switch (level) {
  4. case TRACE:
  5. logger.trace(fqcn, StrUtil.format(format, arguments), t);
  6. break;
  7. case DEBUG:
  8. logger.debug(fqcn, StrUtil.format(format, arguments), t);
  9. break;
  10. case INFO:
  11. logger.info(fqcn, StrUtil.format(format, arguments), t);
  12. break;
  13. case WARN:
  14. logger.warn(fqcn, StrUtil.format(format, arguments), t);
  15. break;
  16. case ERROR:
  17. logger.error(fqcn, StrUtil.format(format, arguments), t);
  18. break;
  19. default:
  20. throw new Error(StrUtil.format("Can not identify level: {}", level));
  21. }
  22. }
  23. }

代码示例来源:origin: org.jboss.jbossas/jboss-as-j2se

  1. log.debug("Added url: "+url+", to ucl: "+this);
  2. log.warn("Failed to strip query from: "+url, e);
  3. clearBlacklists();
  4. else if( log.isTraceEnabled() )
  5. log.trace("Ignoring duplicate url: "+url+", for ucl: "+this);

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

  1. switch (stability) {
  2. case STABLE:
  3. log.debug("Calling a stable server");
  4. break;
  5. case SNAPSHOT:
  6. log.warn("Calling a snapshot server");
  7. break;
  8. default:

代码示例来源:origin: org.keycloak/keycloak-model-jpa

  1. @Override
  2. public boolean acquireLock() {
  3. if (hasChangeLogLock) {
  4. // We already have a lock
  5. return true;
  6. }
  7. Executor executor = ExecutorService.getInstance().getExecutor(database);
  8. try {
  9. database.rollback();
  10. // Ensure table created and lock record inserted
  11. this.init();
  12. } catch (DatabaseException de) {
  13. throw new IllegalStateException("Failed to retrieve lock", de);
  14. }
  15. try {
  16. log.debug("Trying to lock database");
  17. executor.execute(new LockDatabaseChangeLogStatement());
  18. log.debug("Successfully acquired database lock");
  19. hasChangeLogLock = true;
  20. database.setCanCacheLiquibaseTableInfo(true);
  21. return true;
  22. } catch (DatabaseException de) {
  23. log.warn("Lock didn't yet acquired. Will possibly retry to acquire lock. Details: " + de.getMessage());
  24. if (log.isTraceEnabled()) {
  25. log.debug(de.getMessage(), de);
  26. }
  27. return false;
  28. }
  29. }

代码示例来源:origin: org.jboss/jboss-common-core

  1. public void run()
  2. {
  3. boolean trace = log.isTraceEnabled();
  4. try
  5. {
  6. if( trace )
  7. log.trace("Begin run, wrapper="+this);
  8. runThread = Thread.currentThread();
  9. started = true;
  10. runnable.run();
  11. runThread = null;
  12. if( trace )
  13. log.trace("End run, wrapper="+this);
  14. }
  15. catch (Throwable t)
  16. {
  17. log.warn("Unhandled throwable for runnable: " + runnable, t);
  18. }
  19. }
  20. }

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

  1. protected void jbossInternalDestroy() {
  2. if (state != STOPPED) {
  3. destroyIgnored = true;
  4. if (log.isDebugEnabled()) {
  5. log.debug("Ignoring destroy call; current state is " + getStateString());
  6. }
  7. return;
  8. }
  9. destroyIgnored = false;
  10. if (log.isDebugEnabled()) {
  11. log.debug("Destroying " + jbossInternalDescription());
  12. }
  13. try {
  14. destroyService();
  15. } catch (Throwable t) {
  16. log.warn(ServiceMBeanLogger.ROOT_LOGGER.destroyingFailed(jbossInternalDescription()), t);
  17. }
  18. state = DESTROYED;
  19. if (log.isDebugEnabled()) {
  20. log.debug("Destroyed " + jbossInternalDescription());
  21. }
  22. if (unregisterIgnored) {
  23. postDeregister();
  24. }
  25. }

代码示例来源:origin: looly/hutool

  1. @Override
  2. public void log(String fqcn, Level level, Throwable t, String format, Object... arguments) {
  3. switch (level) {
  4. case TRACE:
  5. logger.trace(fqcn, StrUtil.format(format, arguments), t);
  6. break;
  7. case DEBUG:
  8. logger.debug(fqcn, StrUtil.format(format, arguments), t);
  9. break;
  10. case INFO:
  11. logger.info(fqcn, StrUtil.format(format, arguments), t);
  12. break;
  13. case WARN:
  14. logger.warn(fqcn, StrUtil.format(format, arguments), t);
  15. break;
  16. case ERROR:
  17. logger.error(fqcn, StrUtil.format(format, arguments), t);
  18. break;
  19. default:
  20. throw new Error(StrUtil.format("Can not identify level: {}", level));
  21. }
  22. }
  23. }

代码示例来源:origin: org.jboss.jbossas/jboss-as-connector

  1. public void onException(JMSException exception)
  2. {
  3. if (isDestroyed)
  4. {
  5. if (log.isTraceEnabled())
  6. log.trace("Ignoring error on already destroyed connection " + this, exception);
  7. return;
  8. }
  9. log.warn("Handling jms exception failure: " + this, exception);
  10. try
  11. {
  12. con.setExceptionListener(null);
  13. }
  14. catch (JMSException e)
  15. {
  16. log.debug("Unable to unset exception listener", e);
  17. }
  18. ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, exception);
  19. sendEvent(event);
  20. }

代码示例来源:origin: org.jboss/jboss-common-core

  1. /**
  2. * Preload the JBoss specific protocol handlers, so that URL knows about
  3. * them even if the handler factory is changed.
  4. */
  5. @SuppressWarnings("unused")
  6. public static void preload()
  7. {
  8. for (int i = 0; i < PROTOCOLS.length; i ++)
  9. {
  10. try
  11. {
  12. URL url = new URL(PROTOCOLS[i], "", -1, "");
  13. log.trace("Loaded protocol: " + PROTOCOLS[i]);
  14. }
  15. catch (Exception e)
  16. {
  17. log.warn("Failed to load protocol: " + PROTOCOLS[i], e);
  18. }
  19. }
  20. }

代码示例来源:origin: apache/activemq-artemis

  1. /** public for tests only, not through API */
  2. public void handleException(List<JDBCJournalRecord> recordRef, Throwable e) {
  3. logger.warn(e.getMessage(), e);
  4. failed.set(true);
  5. criticalIOErrorListener.onIOException(e, "Critical IO Error. Failed to process JDBC Record statements", null);
  6. if (logger.isTraceEnabled()) {
  7. logger.trace("Rolling back Transaction, just in case");
  8. }
  9. try {
  10. connection.rollback();
  11. } catch (Throwable rollback) {
  12. logger.warn(rollback);
  13. }
  14. try {
  15. connection.close();
  16. } catch (Throwable rollback) {
  17. logger.warn(rollback);
  18. }
  19. if (recordRef != null) {
  20. executeCallbacks(recordRef, false);
  21. }
  22. }

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

  1. protected void jbossInternalCreate() throws Exception {
  2. // if (state == CREATED || state == STARTING || state == STARTED
  3. // || state == STOPPING || state == STOPPED)
  4. if (state != REGISTERED) {
  5. createIgnored = true;
  6. if (log.isDebugEnabled()) {
  7. log.debug("Ignoring create call; current state is " + getStateString());
  8. }
  9. return;
  10. }
  11. createIgnored = false;
  12. if (log.isDebugEnabled()) {
  13. log.debug("Creating " + jbossInternalDescription());
  14. }
  15. try {
  16. createService();
  17. state = CREATED;
  18. } catch (Exception e) {
  19. log.warn(ServiceMBeanLogger.ROOT_LOGGER.initializationFailed(jbossInternalDescription()), e);
  20. throw e;
  21. }
  22. if (log.isDebugEnabled()) {
  23. log.debug("Created " + jbossInternalDescription());
  24. }
  25. if (startIgnored) {
  26. start();
  27. }
  28. }

代码示例来源:origin: org.jboss.microcontainer/jboss-kernel

  1. /**
  2. * Undeploy a deployment
  3. *
  4. * @param url the url
  5. */
  6. protected void undeploy(URL url)
  7. {
  8. log.debug("Undeploying " + url);
  9. try
  10. {
  11. deployer.undeploy(url);
  12. log.trace("Undeployed " + url);
  13. }
  14. catch (Throwable t)
  15. {
  16. log.warn("Error during undeployment: " + url, t);
  17. }
  18. }

代码示例来源:origin: org.jboss.genericjms/generic-jms-ra-jar

  1. public void onException(JMSException exception) {
  2. if (isDestroyed) {
  3. if (log.isTraceEnabled()) {
  4. log.trace("Ignoring error on already destroyed connection " + this, exception);
  5. }
  6. return;
  7. }
  8. log.warn("Handling jms exception failure: " + this, exception);
  9. // We need to unlock() before sending the connection error to the
  10. // event listeners. Otherwise the lock won't be in sync once
  11. // cleanup() is called
  12. if (lock.isLocked() && Thread.currentThread().equals(lock.getOwner())) {
  13. unlock();
  14. }
  15. try {
  16. con.setExceptionListener(null);
  17. } catch (JMSException e) {
  18. log.debug("Unable to unset exception listener", e);
  19. }
  20. ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, exception);
  21. sendEvent(event);
  22. }

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

  1. public void putInContext(String key, Object value) {
  2. log.trace("putInContext " + key + "=" + value);
  3. if(value == null) throw new IllegalStateException("value must not be null for " + key);
  4. Object replaced = internalPutInContext(key,value);
  5. if(replaced!=null) {
  6. log.warn( "Overwriting " + replaced + " when setting " + key + " to " + value + ".");
  7. }
  8. }

代码示例来源:origin: org.keycloak/keycloak-kerberos-federation

  1. public String getSerializedDelegationCredential() {
  2. if (delegationCredential == null) {
  3. if (log.isTraceEnabled()) {
  4. log.trace("No delegation credential available.");
  5. }
  6. return null;
  7. }
  8. try {
  9. if (log.isTraceEnabled()) {
  10. log.trace("Serializing credential " + delegationCredential);
  11. }
  12. return KerberosSerializationUtils.serializeCredential(kerberosTicket, delegationCredential);
  13. } catch (KerberosSerializationUtils.KerberosSerializationException kse) {
  14. log.warn("Couldn't serialize credential: " + delegationCredential, kse);
  15. return null;
  16. }
  17. }

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

  1. stopIgnored = true;
  2. if (log.isDebugEnabled()) {
  3. log.debug("Ignoring stop call; current state is " + getStateString());
  4. sendStateChangeNotification(STARTED, STOPPING, getName() + " stopping", null);
  5. if (log.isDebugEnabled()) {
  6. log.debug("Stopping " + jbossInternalDescription());
  7. state = FAILED;
  8. sendStateChangeNotification(STOPPING, FAILED, getName() + " failed", e);
  9. log.warn(ServiceMBeanLogger.ROOT_LOGGER.stoppingFailed(jbossInternalDescription()), e);
  10. return;
  11. sendStateChangeNotification(STOPPING, STOPPED, getName() + " stopped", null);
  12. if (log.isDebugEnabled()) {
  13. log.debug("Stopped " + jbossInternalDescription());

代码示例来源:origin: org.jboss.slf4j/slf4j-jboss-logging

  1. @Override
  2. public void log(Marker marker, String fqcn, int level, String message, Object[] argArray, Throwable t) {
  3. FormattingTuple result = MessageFormatter.arrayFormat(message, argArray);
  4. switch (level) {
  5. case LocationAwareLogger.TRACE_INT:
  6. logger.trace(fqcn, result.getMessage(), t);
  7. break;
  8. case LocationAwareLogger.DEBUG_INT:
  9. logger.debug(fqcn, result.getMessage(), t);
  10. break;
  11. case LocationAwareLogger.INFO_INT:
  12. logger.info(fqcn, result.getMessage(), t);
  13. break;
  14. case LocationAwareLogger.WARN_INT:
  15. logger.warn(fqcn, result.getMessage(), t);
  16. break;
  17. case LocationAwareLogger.ERROR_INT:
  18. logger.error(fqcn, result.getMessage(), t);
  19. break;
  20. default:
  21. throw new IllegalStateException("Level number " + level + " is not recognized.");
  22. }
  23. }

相关文章