net.spy.memcached.compat.log.Logger.isDebugEnabled()方法的使用及代码示例

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

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

Logger.isDebugEnabled介绍

[英]True if debug is enabled for this logger.
[中]如果为此记录器启用了调试,则为True。

代码示例

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

  1. @Override
  2. public boolean isDebugEnabled() {
  3. return logger.isDebugEnabled();
  4. }

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

  1. public Element getElement(String key) {
  2. Element element = cache.get(key);
  3. if (logger.isDebugEnabled()) {
  4. if (null != element) {
  5. logger.debug("ArcusFrontCache: local cache hit for %s", key);
  6. }
  7. }
  8. return element;
  9. }

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

  1. @Override
  2. public byte[] compress(byte[] bytes) {
  3. try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
  4. GZIPOutputStream gzos = new GZIPOutputStream(baos)) {
  5. gzos.write(bytes);
  6. gzos.flush();
  7. gzos.close();
  8. final byte[] compressedBytes = baos.toByteArray();
  9. if (getLogger().isDebugEnabled()) {
  10. getLogger().debug(String.format("gzip-compression original-size : %d compressed-size : %d", bytes.length, compressedBytes.length));
  11. }
  12. return compressedBytes;
  13. } catch (IOException e) {
  14. throw new IllegalStateException("Failed to compress with gzip.", e);
  15. }
  16. }

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

  1. public <T> T get(String key, Transcoder<T> tc) {
  2. if (cache == null) {
  3. return null;
  4. }
  5. try {
  6. Element element = cache.get(key);
  7. if (null != element) {
  8. if (logger.isDebugEnabled()) {
  9. logger.debug("ArcusFrontCache: local cache hit for %s", key);
  10. }
  11. @SuppressWarnings("unchecked") T ret = (T) element.getObjectValue();
  12. return ret;
  13. }
  14. } catch (Exception e) {
  15. logger.info("failed to get from the local cache : %s", e.getMessage());
  16. return null;
  17. }
  18. return null;
  19. }

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

  1. @Override
  2. public byte[] compress(byte[] bytes) {
  3. final int originalBytesLength = bytes.length;
  4. try (ByteArrayOutputStream baos = new ByteArrayOutputStream(originalBytesLength)) {
  5. baos.write(IntToBytesUtils.intToBytes(originalBytesLength));
  6. byte[] compressedBytes = Lz4CompressUtils.compress(bytes);
  7. if (getLogger().isDebugEnabled()) {
  8. getLogger().debug(String.format("lz4-compression original-size : %d compressed-size : %d", bytes.length, compressedBytes.length));
  9. }
  10. baos.write(compressedBytes);
  11. baos.flush();
  12. baos.close();
  13. return baos.toByteArray();
  14. } catch (IOException e) {
  15. throw new IllegalStateException("Failed to compress with lz4.", e);
  16. }
  17. }

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

  1. @Override
  2. public void initialize() {
  3. int size = CMD.length() + KeyUtil.getKeyBytes(key).length + 16;
  4. ByteBuffer bb = ByteBuffer.allocate(size);
  5. setArguments(bb, CMD, key);
  6. bb.flip();
  7. setBuffer(bb);
  8. if (getLogger().isDebugEnabled()) {
  9. getLogger().debug("Request in ascii protocol: "
  10. + (new String(bb.array())).replace("\r\n", "\\r\\n"));
  11. }
  12. }

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

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

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

  1. @Override
  2. public void initialize() {
  3. ByteBuffer bb = ByteBuffer.allocate(data.length
  4. + KeyUtil.getKeyBytes(key).length + OVERHEAD);
  5. setArguments(bb, type, key, flags, exp, data.length);
  6. assert bb.remaining() >= data.length + 2
  7. : "Not enough room in buffer, need another "
  8. + (2 + data.length - bb.remaining());
  9. bb.put(data);
  10. bb.put(CRLF);
  11. bb.flip();
  12. setBuffer(bb);
  13. if (getLogger().isDebugEnabled()) {
  14. getLogger().debug("Request in ascii protocol: "
  15. + (new String(bb.array())).replace("\r\n", "\\r\\n"));
  16. }
  17. }

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

  1. @Override
  2. public void initialize() {
  3. ByteBuffer buffer = store.getAsciiCommand();
  4. setBuffer(buffer);
  5. if (getLogger().isDebugEnabled()) {
  6. getLogger().debug("Request in ascii protocol: \n"
  7. + (new String(buffer.array())).replaceAll("\\r\\n", "\n"));
  8. }
  9. }

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

  1. @Override
  2. public void initialize() {
  3. ByteBuffer buffer = store.getAsciiCommand();
  4. setBuffer(buffer);
  5. if (getLogger().isDebugEnabled()) {
  6. getLogger().debug("Request in ascii protocol: \n"
  7. + (new String(buffer.array())).replaceAll("\\r\\n", "\n"));
  8. }
  9. }

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

  1. @Override
  2. public void initialize() {
  3. ByteBuffer buffer = setPipedExist.getAsciiCommand();
  4. setBuffer(buffer);
  5. if (getLogger().isDebugEnabled()) {
  6. getLogger().debug(
  7. "Request in ascii protocol: \n"
  8. + (new String(buffer.array())).replaceAll("\\r\\n",
  9. "\n"));
  10. }
  11. }

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

  1. @Override
  2. public void initialize() {
  3. ByteBuffer buffer = update.getAsciiCommand();
  4. setBuffer(buffer);
  5. if (getLogger().isDebugEnabled()) {
  6. getLogger().debug(
  7. "Request in ascii protocol: \n"
  8. + (new String(buffer.array())).replaceAll("\\r\\n",
  9. "\n"));
  10. }
  11. }

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

  1. @Override
  2. public void initialize() {
  3. ByteBuffer bb = ByteBuffer.allocate(KeyUtil.getKeyBytes(key).length +
  4. attrs.getLength() + OVERHEAD);
  5. setArguments(bb, "setattr", key, attrs);
  6. bb.flip();
  7. setBuffer(bb);
  8. if (getLogger().isDebugEnabled()) {
  9. getLogger().debug("Request in ascii protocol: "
  10. + (new String(bb.array())).replace("\r\n", "\\r\\n"));
  11. }
  12. }

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

  1. @Override
  2. public void initialize() {
  3. String cmd = get.getCommand();
  4. String args = get.stringify();
  5. ByteBuffer bb = ByteBuffer.allocate(KeyUtil.getKeyBytes(key).length
  6. + cmd.length() + args.length() + 16);
  7. setArguments(bb, cmd, key, args);
  8. bb.flip();
  9. setBuffer(bb);
  10. if (getLogger().isDebugEnabled()) {
  11. getLogger().debug("Request in ascii protocol: " + (new String(bb.array())).replace("\r\n", "\\r\\n"));
  12. }
  13. }

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

  1. @Override
  2. public void initialize() {
  3. String args = collectionCreate.stringify();
  4. ByteBuffer bb = ByteBuffer.allocate(KeyUtil.getKeyBytes(key).length
  5. + args.length()
  6. + OVERHEAD);
  7. setArguments(bb, collectionCreate.getCommand(), key, args);
  8. bb.flip();
  9. setBuffer(bb);
  10. if (getLogger().isDebugEnabled()) {
  11. getLogger().debug("Request in ascii protocol: "
  12. + (new String(bb.array())).replaceAll("\\r\\n", ""));
  13. }
  14. }

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

  1. @Override
  2. public void initialize() {
  3. String cmd = get.getCommand();
  4. String args = get.stringify();
  5. ByteBuffer bb = ByteBuffer.allocate(cmd.length() + KeyUtil.getKeyBytes(key).length
  6. + args.length() + 16);
  7. setArguments(bb, cmd, key, args);
  8. bb.flip();
  9. setBuffer(bb);
  10. if (getLogger().isDebugEnabled()) {
  11. getLogger().debug(
  12. "Request in ascii protocol: "
  13. + (new String(bb.array()))
  14. .replace("\r\n", "\\r\\n"));
  15. }
  16. }

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

  1. public void initialize() {
  2. String cmd = collectionCount.getCommand();
  3. String args = collectionCount.stringify();
  4. ByteBuffer bb = ByteBuffer.allocate(KeyUtil.getKeyBytes(key).length
  5. + cmd.length() + args.length() + 16);
  6. setArguments(bb, cmd, key, args);
  7. bb.flip();
  8. setBuffer(bb);
  9. if (getLogger().isDebugEnabled()) {
  10. getLogger().debug(
  11. "Request in ascii protocol: "
  12. + (new String(bb.array()))
  13. .replace("\r\n", "\\r\\n"));
  14. }
  15. }

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

  1. @Override
  2. public void initialize() {
  3. String cmd = get.getCommand();
  4. String args = get.stringify();
  5. ByteBuffer bb = ByteBuffer.allocate(KeyUtil.getKeyBytes(key).length
  6. + cmd.length() + args.length() + 16);
  7. setArguments(bb, cmd, key, args);
  8. bb.flip();
  9. setBuffer(bb);
  10. if (getLogger().isDebugEnabled()) {
  11. getLogger().debug(
  12. "Request in ascii protocol: "
  13. + (new String(bb.array()))
  14. .replace("\r\n", "\\r\\n"));
  15. }
  16. }

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

  1. public void initialize() {
  2. String cmd = collectionMutate.getCommand();
  3. String args = collectionMutate.stringify();
  4. ByteBuffer bb = ByteBuffer.allocate(KeyUtil.getKeyBytes(key).length
  5. + KeyUtil.getKeyBytes(subkey).length
  6. + cmd.length() + args.length() + 16);
  7. setArguments(bb, cmd, key, subkey, args);
  8. bb.flip();
  9. setBuffer(bb);
  10. if (getLogger().isDebugEnabled()) {
  11. getLogger().debug(
  12. "Request in ascii protocol: "
  13. + (new String(bb.array()))
  14. .replace("\r\n", "\\r\\n"));
  15. }
  16. }

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

  1. @Override
  2. public void handleLine(String line) {
  3. if (line.startsWith("ATTR ")) {
  4. getLogger().debug("Got line %s", line);
  5. String[] stuff = line.split(" ");
  6. assert stuff.length == 2;
  7. assert stuff[0].equals("ATTR");
  8. cb.gotAttribute(key, stuff[1]);
  9. } else {
  10. OperationStatus status = matchStatus(line, END, NOT_FOUND,
  11. ATTR_ERROR_NOT_FOUND);
  12. if (getLogger().isDebugEnabled()) {
  13. getLogger().debug(status);
  14. }
  15. getCallback().receivedStatus(status);
  16. transitionState(OperationState.COMPLETE);
  17. }
  18. }

相关文章