net.spy.memcached.compat.log.Logger类的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(197)

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

Logger介绍

[英]Abstract mechanism for dealing with logs from various objects. Implementations are expected to have a constructor that takes a single String representing the name of the logging item, or an empty constructor.
[中]处理来自不同对象的日志的抽象机制。实现应该有一个构造函数,该构造函数接受表示日志项名称的单个字符串,或者是一个空构造函数。

代码示例

代码示例来源:origin: apache/incubator-druid

@Override
protected byte[] compress(byte[] in)
{
 if (in == null) {
  throw new NullPointerException("Can't compress null");
 }
 LZ4Compressor compressor = lz4Factory.fastCompressor();
 byte[] out = new byte[compressor.maxCompressedLength(in.length)];
 int compressedLength = compressor.compress(in, 0, in.length, out, 0);
 getLogger().debug("Compressed %d bytes to %d", in.length, compressedLength);
 return ByteBuffer.allocate(Integer.BYTES + compressedLength)
          .putInt(in.length)
          .put(out, 0, compressedLength)
          .array();
}

代码示例来源:origin: Netflix/EVCache

public void shutdown() {
  removeMonitoring();
  writeQ.clear();
  readQ.clear();
  inputQueue.clear();
  try {
    // Cleanup the ByteBuffers only if they are sun.nio.ch.DirectBuffer
    // If we don't cleanup then we will leak 16K of memory
    if (getRbuf() instanceof DirectBuffer) {
      Cleaner cleaner = ((DirectBuffer) getRbuf()).cleaner();
      if (cleaner != null) cleaner.clean();
      cleaner = ((DirectBuffer) getWbuf()).cleaner();
      if (cleaner != null) cleaner.clean();
    }
  } catch (Throwable t) {
    getLogger().error("Exception cleaning ByteBuffer.", t);
  }
}

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

@Override
public MetricCollector getMetricCollector() {
  String enableMetrics = metricsConfig.get("memcached.enabled");
  if (enableMetrics().equals(MetricType.OFF) || enableMetrics == null
      || "false".equalsIgnoreCase(enableMetrics)) {
    getLogger().debug("Memcached metrics collection disabled.");
    return new NoopMetricCollector();
  } else {
    getLogger().info("Memcached metrics collection enabled (Profile " + enableMetrics() + ").");
    return new MemcachedMetrics();
  }
}

代码示例来源:origin: naver/arcus-java-client

public Element getElement(String key) {
 Element element = cache.get(key);
 if (logger.isDebugEnabled()) {
  if (null != element) {
   logger.debug("ArcusFrontCache: local cache hit for %s", key);
  }
 }
 return element;
}

代码示例来源:origin: com.couchbase.client/couchbase-client

private void logRunException(Exception e) {
 if (shutDown) {
  // There are a couple types of errors that occur during the
  // shutdown sequence that are considered OK. Log at debug.
  getLogger().debug("Exception occurred during shutdown", e);
 } else {
  getLogger().warn("Problem handling Couchbase IO", e);
 }
}

代码示例来源:origin: com.google.code.maven-play-plugin.spy/memcached

/**
 * Close a closeable.
 */
public static void close(Closeable closeable) {
  if (closeable != null) {
    try {
      closeable.close();
    } catch (Exception e) {
      logger.info("Unable to close %s", closeable, e);
    }
  }
}

代码示例来源:origin: com.couchbase.client/couchbase-client

@Override
 public void run() {
  try {
   ioReactor.execute(ioEventDispatch);
  } catch (InterruptedIOException ex) {
   getLogger().error("I/O reactor Interrupted", ex);
  } catch (IOException e) {
   getLogger().error("I/O error: " + e.getMessage(), e);
  }
  getLogger().debug("I/O reactor terminated");
 }
}, "Couchbase ClusterManager Thread");

代码示例来源:origin: com.couchbase.client/couchbase-client

@Override
 public void cancelled() {
  getLogger().warn("Cluster Response was cancelled.");
  latch.countDown();
 }
}

代码示例来源:origin: com.couchbase.client/couchbase-client

@Override
 public void run() {
  try {
   ioReactor.execute(ioEventDispatch);
  } catch (InterruptedIOException ex) {
   getLogger().error("I/O reactor Interrupted", ex);
  } catch (IOException e) {
   getLogger().error("I/O error: " + e.getMessage(), e);
  }
  getLogger().info("I/O reactor terminated");
 }
}, "Couchbase View Thread");

代码示例来源:origin: com.couchbase.client/couchbase-client

@Override
public boolean isDebugEnabled() {
 return logger.isDebugEnabled();
}

代码示例来源:origin: com.couchbase.client/couchbase-client

@Override
public void log(Level level, Object o) {
 logger.log(Level.DEBUG, o);
}

代码示例来源:origin: naver/arcus-java-client

/**
 * Get the cache list asynchronously from the Arcus admin.
 */
void asyncGetCacheList() {
 if (getLogger().isDebugEnabled()) {
  getLogger().debug("Set a new watch on " + (cacheListZPath + serviceCode));
 }
 zk.getChildren(cacheListZPath + serviceCode, this, this, null);
}

代码示例来源:origin: com.google.code.simple-spring-memcached/spymemcached

private void logRunException(Exception e) {
  if (shutDown) {
   // There are a couple types of errors that occur during the
   // shutdown sequence that are considered OK. Log at debug.
   getLogger().debug("Exception occurred during shutdown", e);
  } else {
   getLogger().warn("Problem handling memcached IO", e);
  }
 }
}

代码示例来源:origin: com.google.code.maven-play-plugin.spy/spymemcached

/**
 * Close a closeable.
 */
public static void close(Closeable closeable) {
  if (closeable != null) {
    try {
      closeable.close();
    } catch (Exception e) {
      logger.info("Unable to close %s", closeable, e);
    }
  }
}

代码示例来源:origin: com.couchbase.client/couchbase-client

@Override
public void failed(Exception ex) {
 getLogger().warn("Cluster Response failed with: ", ex);
 latch.countDown();
}

代码示例来源:origin: com.couchbase.client/couchbase-client

@Override
public void log(Level level, Object o, Throwable throwable) {
 logger.log(Level.DEBUG, o, throwable);
}

代码示例来源:origin: kr.pe.kwonnam.spymemcached-extra-transcoders/gzip-compress-transcoder

@Override
public byte[] compress(byte[] bytes) {
  try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
     GZIPOutputStream gzos = new GZIPOutputStream(baos)) {
    gzos.write(bytes);
    gzos.flush();
    gzos.close();
    final byte[] compressedBytes = baos.toByteArray();
    if (getLogger().isDebugEnabled()) {
      getLogger().debug(String.format("gzip-compression original-size : %d compressed-size : %d", bytes.length, compressedBytes.length));
    }
    return compressedBytes;
  } catch (IOException e) {
    throw new IllegalStateException("Failed to compress with gzip.", e);
  }
}

代码示例来源:origin: com.couchbase.client/couchbase-client

private void logRunException(Exception e) {
 if (shutDown) {
  // There are a couple types of errors that occur during the
  // shutdown sequence that are considered OK. Log at debug.
  getLogger().debug("Exception occurred during shutdown", e);
 } else {
  getLogger().warn("Problem handling Couchbase IO", e);
 }
}

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

for (long position : ketamaNodePositionsAtIteration(node, i)) {
  newNodeMap.put(position, node);
  getLogger().debug("Adding node %s with weight %s in position %d", node, thisWeight, position);
  for (long position : ketamaNodePositionsAtIteration(node, i)) {
    newNodeMap.put(position, node);
    getLogger().debug("Adding node %s in position %d", node, position);

代码示例来源:origin: naver/arcus-java-client

/**
 * Close a closeable.
 */
public static void close(Closeable closeable) {
 if (closeable != null) {
  try {
   closeable.close();
  } catch (Exception e) {
   logger.info("Unable to close %s", closeable, e);
  }
 }
}

相关文章