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

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

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

@Override
protected final void doTask(Runnable task) {
 try {
   task.run();
 } catch (ActiveMQInterruptedException e) {
   // This could happen during shutdowns. Nothing to be concerned about here
   logger.debug("Interrupted Thread", e);
 } catch (Throwable t) {
   logger.warn(t.getMessage(), t);
 }
}

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

public static void debugFrame(Logger logger, String message, ByteBuf byteIn) {
 if (logger.isTraceEnabled()) {
   int location = byteIn.readerIndex();
   // debugging
   byte[] frame = new byte[byteIn.writerIndex()];
   byteIn.readBytes(frame);
   try {
    logger.trace(message + "\n" + ByteUtil.formatGroup(ByteUtil.bytesToHex(frame), 8, 16));
   } catch (Exception e) {
    logger.warn(e.getMessage(), e);
   }
   byteIn.readerIndex(location);
 }
}

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

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

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

@Override
  public void log(String fqcn, Level level, Throwable t, String format, Object... arguments) {
    switch (level) {
      case TRACE:
        logger.trace(fqcn, StrUtil.format(format, arguments), t);
        break;
      case DEBUG:
        logger.debug(fqcn, StrUtil.format(format, arguments), t);
        break;
      case INFO:
        logger.info(fqcn, StrUtil.format(format, arguments), t);
        break;
      case WARN:
        logger.warn(fqcn, StrUtil.format(format, arguments), t);
        break;
      case ERROR:
        logger.error(fqcn, StrUtil.format(format, arguments), t);
        break;
      default:
        throw new Error(StrUtil.format("Can not identify level: {}", level));
    }
  }
}

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

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

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

switch (stability) {
  case STABLE:
    log.debug("Calling a stable server");
    break;
  case SNAPSHOT:
    log.warn("Calling a snapshot server");
    break;
  default:

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

@Override
public boolean acquireLock() {
  if (hasChangeLogLock) {
    // We already have a lock
    return true;
  }
  Executor executor = ExecutorService.getInstance().getExecutor(database);
  try {
    database.rollback();
    // Ensure table created and lock record inserted
    this.init();
  } catch (DatabaseException de) {
    throw new IllegalStateException("Failed to retrieve lock", de);
  }
  try {
    log.debug("Trying to lock database");
    executor.execute(new LockDatabaseChangeLogStatement());
    log.debug("Successfully acquired database lock");
    hasChangeLogLock = true;
    database.setCanCacheLiquibaseTableInfo(true);
    return true;
  } catch (DatabaseException de) {
    log.warn("Lock didn't yet acquired. Will possibly retry to acquire lock. Details: " + de.getMessage());
    if (log.isTraceEnabled()) {
      log.debug(de.getMessage(), de);
    }
    return false;
  }
}

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

public void run()
  {
   boolean trace = log.isTraceEnabled();
   try
   {
     if( trace )
      log.trace("Begin run, wrapper="+this);
     runThread = Thread.currentThread();
     started = true;
     runnable.run();
     runThread = null;
     if( trace )
      log.trace("End run, wrapper="+this);
   }
   catch (Throwable t)
   {
     log.warn("Unhandled throwable for runnable: " + runnable, t);
   }
  }
}

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

protected void jbossInternalDestroy() {
  if (state != STOPPED) {
    destroyIgnored = true;
    if (log.isDebugEnabled()) {
      log.debug("Ignoring destroy call; current state is " + getStateString());
    }
    return;
  }
  destroyIgnored = false;
  if (log.isDebugEnabled()) {
    log.debug("Destroying " + jbossInternalDescription());
  }
  try {
    destroyService();
  } catch (Throwable t) {
    log.warn(ServiceMBeanLogger.ROOT_LOGGER.destroyingFailed(jbossInternalDescription()), t);
  }
  state = DESTROYED;
  if (log.isDebugEnabled()) {
    log.debug("Destroyed " + jbossInternalDescription());
  }
  if (unregisterIgnored) {
    postDeregister();
  }
}

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

@Override
  public void log(String fqcn, Level level, Throwable t, String format, Object... arguments) {
    switch (level) {
      case TRACE:
        logger.trace(fqcn, StrUtil.format(format, arguments), t);
        break;
      case DEBUG:
        logger.debug(fqcn, StrUtil.format(format, arguments), t);
        break;
      case INFO:
        logger.info(fqcn, StrUtil.format(format, arguments), t);
        break;
      case WARN:
        logger.warn(fqcn, StrUtil.format(format, arguments), t);
        break;
      case ERROR:
        logger.error(fqcn, StrUtil.format(format, arguments), t);
        break;
      default:
        throw new Error(StrUtil.format("Can not identify level: {}", level));
    }
  }
}

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

public void onException(JMSException exception)
{
 if (isDestroyed)
 {
   if (log.isTraceEnabled())
    log.trace("Ignoring error on already destroyed connection " + this, exception);
   return;
 }
 log.warn("Handling jms exception failure: " + this, exception);
 try
 {
   con.setExceptionListener(null);
 }
 catch (JMSException e)
 {
   log.debug("Unable to unset exception listener", e);
 }
 
 ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, exception);
 sendEvent(event);
}

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

/**
* Preload the JBoss specific protocol handlers, so that URL knows about
* them even if the handler factory is changed.
*/
@SuppressWarnings("unused")
public static void preload()
{
 for (int i = 0; i < PROTOCOLS.length; i ++)
 {
   try
   {
    URL url = new URL(PROTOCOLS[i], "", -1, "");
    log.trace("Loaded protocol: " + PROTOCOLS[i]);
   }
   catch (Exception e)
   {
    log.warn("Failed to load protocol: " + PROTOCOLS[i], e);
   }
 }
}

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

/** public for tests only, not through API */
public void handleException(List<JDBCJournalRecord> recordRef, Throwable e) {
 logger.warn(e.getMessage(), e);
 failed.set(true);
 criticalIOErrorListener.onIOException(e, "Critical IO Error.  Failed to process JDBC Record statements", null);
 if (logger.isTraceEnabled()) {
   logger.trace("Rolling back Transaction, just in case");
 }
 try {
   connection.rollback();
 } catch (Throwable rollback) {
   logger.warn(rollback);
 }
 try {
   connection.close();
 } catch (Throwable rollback) {
   logger.warn(rollback);
 }
 if (recordRef != null) {
   executeCallbacks(recordRef, false);
 }
}

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

protected void jbossInternalCreate() throws Exception {
  // if (state == CREATED || state == STARTING || state == STARTED
  // || state == STOPPING || state == STOPPED)
  if (state != REGISTERED) {
    createIgnored = true;
    if (log.isDebugEnabled()) {
      log.debug("Ignoring create call; current state is " + getStateString());
    }
    return;
  }
  createIgnored = false;
  if (log.isDebugEnabled()) {
    log.debug("Creating " + jbossInternalDescription());
  }
  try {
    createService();
    state = CREATED;
  } catch (Exception e) {
    log.warn(ServiceMBeanLogger.ROOT_LOGGER.initializationFailed(jbossInternalDescription()), e);
    throw e;
  }
  if (log.isDebugEnabled()) {
    log.debug("Created " + jbossInternalDescription());
  }
  if (startIgnored) {
    start();
  }
}

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

/**
* Undeploy a deployment
* 
* @param url the url
*/
protected void undeploy(URL url)
{
 log.debug("Undeploying " + url);
 try
 {
   deployer.undeploy(url);
   log.trace("Undeployed " + url);
 }
 catch (Throwable t)
 {
   log.warn("Error during undeployment: " + url, t);
 }
}

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

public void onException(JMSException exception) {
  if (isDestroyed) {
    if (log.isTraceEnabled()) {
      log.trace("Ignoring error on already destroyed connection " + this, exception);
    }
    return;
  }
  log.warn("Handling jms exception failure: " + this, exception);
  // We need to unlock() before sending the connection error to the
  // event listeners. Otherwise the lock won't be in sync once
  // cleanup() is called
  if (lock.isLocked() && Thread.currentThread().equals(lock.getOwner())) {
    unlock();
  }
  try {
    con.setExceptionListener(null);
  } catch (JMSException e) {
    log.debug("Unable to unset exception listener", e);
  }
  ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, exception);
  sendEvent(event);
}

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

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

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

public String getSerializedDelegationCredential() {
  if (delegationCredential == null) {
    if (log.isTraceEnabled()) {
      log.trace("No delegation credential available.");
    }
    return null;
  }
  try {
    if (log.isTraceEnabled()) {
      log.trace("Serializing credential " + delegationCredential);
    }
    return KerberosSerializationUtils.serializeCredential(kerberosTicket, delegationCredential);
  } catch (KerberosSerializationUtils.KerberosSerializationException kse) {
    log.warn("Couldn't serialize credential: " + delegationCredential, kse);
    return null;
  }
}

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

stopIgnored = true;
  if (log.isDebugEnabled()) {
    log.debug("Ignoring stop call; current state is " + getStateString());
sendStateChangeNotification(STARTED, STOPPING, getName() + " stopping", null);
if (log.isDebugEnabled()) {
  log.debug("Stopping " + jbossInternalDescription());
  state = FAILED;
  sendStateChangeNotification(STOPPING, FAILED, getName() + " failed", e);
  log.warn(ServiceMBeanLogger.ROOT_LOGGER.stoppingFailed(jbossInternalDescription()), e);
  return;
sendStateChangeNotification(STOPPING, STOPPED, getName() + " stopped", null);
if (log.isDebugEnabled()) {
  log.debug("Stopped " + jbossInternalDescription());

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

@Override
public void log(Marker marker, String fqcn, int level, String message, Object[] argArray, Throwable t) {
  FormattingTuple result = MessageFormatter.arrayFormat(message, argArray);
  switch (level) {
    case LocationAwareLogger.TRACE_INT:
      logger.trace(fqcn, result.getMessage(), t);
      break;
    case LocationAwareLogger.DEBUG_INT:
      logger.debug(fqcn, result.getMessage(), t);
      break;
    case LocationAwareLogger.INFO_INT:
      logger.info(fqcn, result.getMessage(), t);
      break;
    case LocationAwareLogger.WARN_INT:
      logger.warn(fqcn, result.getMessage(), t);
      break;
    case LocationAwareLogger.ERROR_INT:
      logger.error(fqcn, result.getMessage(), t);
      break;
    default:
      throw new IllegalStateException("Level number " + level + " is not recognized.");
  }
}

相关文章