org.apache.juli.logging.Log.warn()方法的使用及代码示例

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

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

Log.warn介绍

[英]Log a message with warn log level.
[中]使用警告日志级别记录消息。

代码示例

代码示例来源:origin: apache/geode

if (manager.getLogger().isDebugEnabled()) {
 StringBuilder builder = new StringBuilder();
 builder.append(this).append(": Handling failover of session ").append(sessionId)
   .append(" from ").append(requestJvmRoute).append(" to ").append(localJvmRoute);
 manager.getLogger().debug(builder.toString());
 builder.append(this).append(": Caught exception attempting to find session ")
   .append(sessionId).append(" in ").append(manager);
 manager.getLogger().warn(builder.toString(), e);
 builder.append(this).append(": Did not find session ").append(sessionId)
   .append(" to failover in ").append(manager);
 manager.getLogger().warn(builder.toString());
} else {

代码示例来源:origin: camunda/camunda-bpm-platform

protected void deregisterJmx() {
  try {
    if (mbeans.remove(poolName)!=null) {
      ObjectName oname = getObjectName(getClass(),poolName);
      ManagementFactory.getPlatformMBeanServer().unregisterMBean(oname);
    }
  } catch (MBeanRegistrationException e) {
    log.debug("Jmx deregistration failed.",e);
  } catch (InstanceNotFoundException e) {
    log.debug("Jmx deregistration failed.",e);
  } catch (MalformedObjectNameException e) {
    log.warn("Jmx deregistration failed.",e);
  } catch (RuntimeOperationsException e) {
    log.warn("Jmx deregistration failed.",e);
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

public void setObjectMaxSize(int objectMaxSize) {
  if (objectMaxSize * 1024L > Integer.MAX_VALUE) {
    log.warn(sm.getString("cache.objectMaxSizeTooBigBytes", Integer.valueOf(objectMaxSize)));
    this.objectMaxSize = Integer.MAX_VALUE;
  }
  // Internally bytes, externally kilobytes
  this.objectMaxSize = objectMaxSize * 1024;
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Find the master of the session state
 * @return master member of sessions
 */
protected Member findSessionMasterMember() {
  Member mbr = null;
  Member mbrs[] = cluster.getMembers();
  if(mbrs.length != 0 ) mbr = mbrs[0];
  if(mbr == null && log.isWarnEnabled()) {
    log.warn(sm.getString("deltaManager.noMasterMember",getName(), ""));
  }
  if(mbr != null && log.isDebugEnabled()) {
    log.debug(sm.getString("deltaManager.foundMasterMember",getName(), mbr));
  }
  return mbr;
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * @return list of the allowed cipher suites when connections are made using
 *         StartTLS
 */
private String[] getCipherSuitesArray() {
  if (cipherSuites == null || cipherSuitesArray != null) {
    return cipherSuitesArray;
  }
  if (this.cipherSuites.trim().isEmpty()) {
    containerLog.warn(sm.getString("jndiRealm.emptyCipherSuites"));
    this.cipherSuitesArray = null;
  } else {
    this.cipherSuitesArray = cipherSuites.trim().split("\\s*,\\s*");
    containerLog.debug(sm.getString("jndiRealm.cipherSuites",
        Arrays.toString(this.cipherSuitesArray)));
  }
  return this.cipherSuitesArray;
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina-ha

/**
 * Find the master of the session state
 * @return master member of sessions 
 */
protected Member findSessionMasterMember() {
  Member mbr = null;
  Member mbrs[] = cluster.getMembers();
  if(mbrs.length != 0 ) mbr = mbrs[0];
  if(mbr == null && log.isWarnEnabled()) log.warn(sm.getString("deltaManager.noMasterMember",getName(), ""));
  if(mbr != null && log.isDebugEnabled()) log.warn(sm.getString("deltaManager.foundMasterMember",getName(), mbr));
  return mbr;
}

代码示例来源:origin: apache/geode

@Override
public Principal getPrincipal() {
 if (this.principal == null && this.serializedPrincipal != null) {
  SerializablePrincipal sp = null;
  try {
   sp = (SerializablePrincipal) BlobHelper.deserializeBlob(this.serializedPrincipal);
  } catch (Exception e) {
   StringBuilder builder = new StringBuilder();
   builder.append(this).append(
     ": Serialized principal contains a byte[] that cannot be deserialized due to the following exception");
   ((DeltaSessionManager) getManager()).getLogger().warn(builder.toString(), e);
   return null;
  }
  this.principal =
    sp.getPrincipal(((DeltaSessionManager) this.manager).getTheContext().getRealm());
  if (getManager() != null) {
   DeltaSessionManager mgr = (DeltaSessionManager) getManager();
   if (mgr.getLogger().isDebugEnabled()) {
    mgr.getLogger().debug(this + ": Deserialized principal: " + this.principal);
    // mgr.logCurrentStack();
   }
  }
 }
 return this.principal;
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

public void setName(String name) {
  if (ORDER_OTHERS.equalsIgnoreCase(name)) {
    // This is unusual. This name will be ignored. Log the fact.
    log.warn(sm.getString("webXml.reservedName", name));
  } else {
    this.name = name;
  }
}

代码示例来源:origin: magro/memcached-session-manager

private boolean pingSessionBackup( @Nonnull final String sessionId ) throws InterruptedException {
    final String key = _sessionIdFormat.createBackupKey( sessionId );
    final Future<Boolean> touchResultFuture = _storage.add( key, 1, BYTE_1 );
    try {
      final boolean touchResult = touchResultFuture.get(200, TimeUnit.MILLISECONDS);
      if ( touchResult ) {
        _log.warn( "The secondary backup for session " + sessionId
            + " should be touched in memcached, but it seemed to be"
            + " not existing." );
        return false;
      }
      _log.debug( "The secondary session backup was ping'ed successfully." );
      return true;
    } catch ( final TimeoutException e ) {
      _log.warn( "The secondary backup for session " + sessionId
          + " could not be completed within 200 millis, was cancelled now." );
      return false;
    } catch ( final ExecutionException e ) {
      _log.warn( "An exception occurred when trying to ping session " + sessionId, e );
      return false;
    }
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina-ha

/**
 * Find the master of the session state
 * @return master member of sessions
 */
protected Member findSessionMasterMember() {
  Member mbr = null;
  Member mbrs[] = cluster.getMembers();
  if(mbrs.length != 0 ) mbr = mbrs[0];
  if(mbr == null && log.isWarnEnabled()) {
    log.warn(sm.getString("deltaManager.noMasterMember",getName(), ""));
  }
  if(mbr != null && log.isDebugEnabled()) {
    log.debug(sm.getString("deltaManager.foundMasterMember",getName(), mbr));
  }
  return mbr;
}

代码示例来源:origin: magro/memcached-session-manager

protected void releaseLock( @Nonnull final String sessionId ) {
  try {
    if ( _log.isDebugEnabled() ) {
      _log.debug( "Releasing lock for session " + sessionId );
    }
    final long start = System.currentTimeMillis();
    _storage.delete( _sessionIdFormat.createLockName( sessionId ) ).get();
    _stats.registerSince( RELEASE_LOCK, start );
  } catch ( final Exception e ) {
    _log.warn( "Caught exception when trying to release lock for session " + sessionId, e );
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

public void setName(String name) {
  if (ORDER_OTHERS.equalsIgnoreCase(name)) {
    // This is unusual. This name will be ignored. Log the fact.
    log.warn(sm.getString("webXml.reservedName", name));
  } else {
    this.name = name;
  }
}

代码示例来源:origin: magro/memcached-session-manager

private boolean pingSession( @Nonnull final String sessionId ) throws InterruptedException {
  final Future<Boolean> touchResult = _storage.add( _storageKeyFormat.format(sessionId), 1, BYTE_1 );
  try {
    if ( touchResult.get() ) {
      _stats.nonStickySessionsPingFailed();
      _log.warn( "The session " + sessionId
          + " should be touched in memcached, but it does not exist therein." );
      return false;
    }
    _log.debug( "The session was ping'ed successfully." );
    return true;
  } catch ( final ExecutionException e ) {
    _log.warn( "An exception occurred when trying to ping session " + sessionId, e );
    return false;
  }
}

代码示例来源:origin: magro/memcached-session-manager

/**
 * Return the deserialized map
 *
 *  @param in bytes to deserialize
 *  @return map of deserialized objects
 */
@Override
public ConcurrentMap<String, Object> deserializeAttributes(final byte[] in) {
  final InputStreamReader inputStream = new InputStreamReader( new ByteArrayInputStream( in ) );
  if (LOG.isDebugEnabled()) {
    LOG.debug("deserialize the stream");
  }
  try {
    return deserializer.deserializeInto(inputStream, new ConcurrentHashMap<String, Object>());
  } catch( final RuntimeException e) {
    LOG.warn("Caught Exception deserializing JSON "+e);
    throw new TranscoderDeserializationException(e);
  }
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

public void setName(String name) {
  if (ORDER_OTHERS.equalsIgnoreCase(name)) {
    // This is unusual. This name will be ignored. Log the fact.
    log.warn(sm.getString("webXml.reservedName", name));
  } else {
    this.name = name;
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void performJNDILookup(Context context, PoolConfiguration poolProperties) {
  Object jndiDS = null;
  try {
    if (context!=null) {
      jndiDS = context.lookup(poolProperties.getDataSourceJNDI());
    } else {
      log.warn("dataSourceJNDI property is configued, but local JNDI context is null.");
    }
  } catch (NamingException e) {
    log.debug("The name \""+poolProperties.getDataSourceJNDI()+"\" can not be found in the local context.");
  }
  if (jndiDS==null) {
    try {
      context = new InitialContext();
      jndiDS = context.lookup(poolProperties.getDataSourceJNDI());
    } catch (NamingException e) {
      log.warn("The name \""+poolProperties.getDataSourceJNDI()+"\" can not be found in the InitialContext.");
    }
  }
  if (jndiDS!=null) {
    poolProperties.setDataSource(jndiDS);
  }
}

代码示例来源:origin: magro/memcached-session-manager

@Override
public byte[] serializeAttributes(final MemcachedBackupSession sessions, final ConcurrentMap<String, Object> attributes) {
  if (attributes == null) {
    throw new NullPointerException();
  }
  final ByteArrayOutputStream bos = new ByteArrayOutputStream();
  try {
    // This performs a deep serialization of the target instance.
    // It's serialized to a string as flexjson doesn't like writing to
    // an OutputStreamWriter: it throws the exception "Stepping back two steps is not supported".
    // See https://github.com/moresandeep/memcached-session-manager/commit/db2faaa0a846e16d65ac0b14819689c67bf92c68#commitcomment-512505
    final String serResult = serializer.deepSerialize(attributes);
    if (LOG.isDebugEnabled()) {
      LOG.debug("JSON Serialised object: " + serResult);
    }
    return serResult.getBytes(); // converts to bytes
  } catch (final Exception e) {
    LOG.warn("Caught Exception deserializing JSON " + e);
    throw new IllegalArgumentException();
  } finally {
    close(bos);
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

public void setObjectMaxSize(int objectMaxSize) {
  if (objectMaxSize * 1024L > Integer.MAX_VALUE) {
    log.warn(sm.getString("cache.objectMaxSizeTooBigBytes", Integer.valueOf(objectMaxSize)));
    this.objectMaxSize = Integer.MAX_VALUE;
  }
  // Internally bytes, externally kilobytes
  this.objectMaxSize = objectMaxSize * 1024;
}

代码示例来源:origin: magro/memcached-session-manager

private void pingSession( @Nonnull final MemcachedBackupSession session,
    @Nonnull final BackupSessionService backupSessionService ) throws InterruptedException {
  final Future<Boolean> touchResult = _storage.add( _storageKeyFormat.format(session.getIdInternal()), 5, BYTE_1 );
  try {
    if ( touchResult.get() ) {
      _stats.nonStickySessionsPingFailed();
      _log.warn( "The session " + session.getIdInternal()
          + " should be touched in memcached, but it does not exist"
          + " therein. Will store in memcached again." );
      updateSession( session, backupSessionService );
    }
    else
      _log.debug( "The session was ping'ed successfully." );
  } catch ( final ExecutionException e ) {
    _log.warn( "An exception occurred when trying to ping session " + session.getIdInternal(), e );
  }
}

代码示例来源:origin: magro/memcached-session-manager

protected LockStatus lock( final String sessionId, final long timeout, final TimeUnit timeUnit ) {
  if ( _log.isDebugEnabled() ) {
    _log.debug( "Locking session " + sessionId );
  }
  final long start = System.currentTimeMillis();
  try {
    acquireLock( sessionId, LOCK_RETRY_INTERVAL, LOCK_MAX_RETRY_INTERVAL, timeUnit.toMillis( timeout ),
        System.currentTimeMillis() );
    _stats.registerSince( ACQUIRE_LOCK, start );
    if ( _log.isDebugEnabled() ) {
      _log.debug( "Locked session " + sessionId );
    }
    return LockStatus.LOCKED;
  } catch ( final TimeoutException e ) {
    _log.warn( "Reached timeout when trying to aquire lock for session " + sessionId
        + ". Will use this session without this lock." );
    _stats.registerSince( ACQUIRE_LOCK_FAILURE, start );
    return LockStatus.COULD_NOT_AQUIRE_LOCK;
  } catch ( final InterruptedException e ) {
    Thread.currentThread().interrupt();
    throw new RuntimeException( "Got interrupted while trying to lock session.", e );
  } catch ( final ExecutionException e ) {
    _log.warn( "An exception occurred when trying to aquire lock for session " + sessionId );
    _stats.registerSince( ACQUIRE_LOCK_FAILURE, start );
    return LockStatus.COULD_NOT_AQUIRE_LOCK;
  }
}

相关文章