本文整理了Java中net.spy.memcached.compat.log.Logger.isDebugEnabled()
方法的一些代码示例,展示了Logger.isDebugEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.isDebugEnabled()
方法的具体详情如下:
包路径:net.spy.memcached.compat.log.Logger
类名称:Logger
方法名:isDebugEnabled
[英]True if debug is enabled for this logger.
[中]如果为此记录器启用了调试,则为True。
代码示例来源:origin: com.couchbase.client/couchbase-client
@Override
public boolean isDebugEnabled() {
return logger.isDebugEnabled();
}
代码示例来源: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: 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: naver/arcus-java-client
public <T> T get(String key, Transcoder<T> tc) {
if (cache == null) {
return null;
}
try {
Element element = cache.get(key);
if (null != element) {
if (logger.isDebugEnabled()) {
logger.debug("ArcusFrontCache: local cache hit for %s", key);
}
@SuppressWarnings("unchecked") T ret = (T) element.getObjectValue();
return ret;
}
} catch (Exception e) {
logger.info("failed to get from the local cache : %s", e.getMessage());
return null;
}
return null;
}
代码示例来源:origin: kr.pe.kwonnam.spymemcached-extra-transcoders/lz4-compress-transcoder
@Override
public byte[] compress(byte[] bytes) {
final int originalBytesLength = bytes.length;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream(originalBytesLength)) {
baos.write(IntToBytesUtils.intToBytes(originalBytesLength));
byte[] compressedBytes = Lz4CompressUtils.compress(bytes);
if (getLogger().isDebugEnabled()) {
getLogger().debug(String.format("lz4-compression original-size : %d compressed-size : %d", bytes.length, compressedBytes.length));
}
baos.write(compressedBytes);
baos.flush();
baos.close();
return baos.toByteArray();
} catch (IOException e) {
throw new IllegalStateException("Failed to compress with lz4.", e);
}
}
代码示例来源:origin: naver/arcus-java-client
@Override
public void initialize() {
int size = CMD.length() + KeyUtil.getKeyBytes(key).length + 16;
ByteBuffer bb = ByteBuffer.allocate(size);
setArguments(bb, CMD, key);
bb.flip();
setBuffer(bb);
if (getLogger().isDebugEnabled()) {
getLogger().debug("Request in ascii protocol: "
+ (new String(bb.array())).replace("\r\n", "\\r\\n"));
}
}
代码示例来源: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: naver/arcus-java-client
@Override
public void initialize() {
ByteBuffer bb = ByteBuffer.allocate(data.length
+ KeyUtil.getKeyBytes(key).length + OVERHEAD);
setArguments(bb, type, key, flags, exp, data.length);
assert bb.remaining() >= data.length + 2
: "Not enough room in buffer, need another "
+ (2 + data.length - bb.remaining());
bb.put(data);
bb.put(CRLF);
bb.flip();
setBuffer(bb);
if (getLogger().isDebugEnabled()) {
getLogger().debug("Request in ascii protocol: "
+ (new String(bb.array())).replace("\r\n", "\\r\\n"));
}
}
代码示例来源:origin: naver/arcus-java-client
@Override
public void initialize() {
ByteBuffer buffer = store.getAsciiCommand();
setBuffer(buffer);
if (getLogger().isDebugEnabled()) {
getLogger().debug("Request in ascii protocol: \n"
+ (new String(buffer.array())).replaceAll("\\r\\n", "\n"));
}
}
代码示例来源:origin: naver/arcus-java-client
@Override
public void initialize() {
ByteBuffer buffer = store.getAsciiCommand();
setBuffer(buffer);
if (getLogger().isDebugEnabled()) {
getLogger().debug("Request in ascii protocol: \n"
+ (new String(buffer.array())).replaceAll("\\r\\n", "\n"));
}
}
代码示例来源:origin: naver/arcus-java-client
@Override
public void initialize() {
ByteBuffer buffer = setPipedExist.getAsciiCommand();
setBuffer(buffer);
if (getLogger().isDebugEnabled()) {
getLogger().debug(
"Request in ascii protocol: \n"
+ (new String(buffer.array())).replaceAll("\\r\\n",
"\n"));
}
}
代码示例来源:origin: naver/arcus-java-client
@Override
public void initialize() {
ByteBuffer buffer = update.getAsciiCommand();
setBuffer(buffer);
if (getLogger().isDebugEnabled()) {
getLogger().debug(
"Request in ascii protocol: \n"
+ (new String(buffer.array())).replaceAll("\\r\\n",
"\n"));
}
}
代码示例来源:origin: naver/arcus-java-client
@Override
public void initialize() {
ByteBuffer bb = ByteBuffer.allocate(KeyUtil.getKeyBytes(key).length +
attrs.getLength() + OVERHEAD);
setArguments(bb, "setattr", key, attrs);
bb.flip();
setBuffer(bb);
if (getLogger().isDebugEnabled()) {
getLogger().debug("Request in ascii protocol: "
+ (new String(bb.array())).replace("\r\n", "\\r\\n"));
}
}
代码示例来源:origin: naver/arcus-java-client
@Override
public void initialize() {
String cmd = get.getCommand();
String args = get.stringify();
ByteBuffer bb = ByteBuffer.allocate(KeyUtil.getKeyBytes(key).length
+ cmd.length() + args.length() + 16);
setArguments(bb, cmd, key, args);
bb.flip();
setBuffer(bb);
if (getLogger().isDebugEnabled()) {
getLogger().debug("Request in ascii protocol: " + (new String(bb.array())).replace("\r\n", "\\r\\n"));
}
}
代码示例来源:origin: naver/arcus-java-client
@Override
public void initialize() {
String args = collectionCreate.stringify();
ByteBuffer bb = ByteBuffer.allocate(KeyUtil.getKeyBytes(key).length
+ args.length()
+ OVERHEAD);
setArguments(bb, collectionCreate.getCommand(), key, args);
bb.flip();
setBuffer(bb);
if (getLogger().isDebugEnabled()) {
getLogger().debug("Request in ascii protocol: "
+ (new String(bb.array())).replaceAll("\\r\\n", ""));
}
}
代码示例来源:origin: naver/arcus-java-client
@Override
public void initialize() {
String cmd = get.getCommand();
String args = get.stringify();
ByteBuffer bb = ByteBuffer.allocate(cmd.length() + KeyUtil.getKeyBytes(key).length
+ args.length() + 16);
setArguments(bb, cmd, key, args);
bb.flip();
setBuffer(bb);
if (getLogger().isDebugEnabled()) {
getLogger().debug(
"Request in ascii protocol: "
+ (new String(bb.array()))
.replace("\r\n", "\\r\\n"));
}
}
代码示例来源:origin: naver/arcus-java-client
public void initialize() {
String cmd = collectionCount.getCommand();
String args = collectionCount.stringify();
ByteBuffer bb = ByteBuffer.allocate(KeyUtil.getKeyBytes(key).length
+ cmd.length() + args.length() + 16);
setArguments(bb, cmd, key, args);
bb.flip();
setBuffer(bb);
if (getLogger().isDebugEnabled()) {
getLogger().debug(
"Request in ascii protocol: "
+ (new String(bb.array()))
.replace("\r\n", "\\r\\n"));
}
}
代码示例来源:origin: naver/arcus-java-client
@Override
public void initialize() {
String cmd = get.getCommand();
String args = get.stringify();
ByteBuffer bb = ByteBuffer.allocate(KeyUtil.getKeyBytes(key).length
+ cmd.length() + args.length() + 16);
setArguments(bb, cmd, key, args);
bb.flip();
setBuffer(bb);
if (getLogger().isDebugEnabled()) {
getLogger().debug(
"Request in ascii protocol: "
+ (new String(bb.array()))
.replace("\r\n", "\\r\\n"));
}
}
代码示例来源:origin: naver/arcus-java-client
public void initialize() {
String cmd = collectionMutate.getCommand();
String args = collectionMutate.stringify();
ByteBuffer bb = ByteBuffer.allocate(KeyUtil.getKeyBytes(key).length
+ KeyUtil.getKeyBytes(subkey).length
+ cmd.length() + args.length() + 16);
setArguments(bb, cmd, key, subkey, args);
bb.flip();
setBuffer(bb);
if (getLogger().isDebugEnabled()) {
getLogger().debug(
"Request in ascii protocol: "
+ (new String(bb.array()))
.replace("\r\n", "\\r\\n"));
}
}
代码示例来源:origin: naver/arcus-java-client
@Override
public void handleLine(String line) {
if (line.startsWith("ATTR ")) {
getLogger().debug("Got line %s", line);
String[] stuff = line.split(" ");
assert stuff.length == 2;
assert stuff[0].equals("ATTR");
cb.gotAttribute(key, stuff[1]);
} else {
OperationStatus status = matchStatus(line, END, NOT_FOUND,
ATTR_ERROR_NOT_FOUND);
if (getLogger().isDebugEnabled()) {
getLogger().debug(status);
}
getCallback().receivedStatus(status);
transitionState(OperationState.COMPLETE);
}
}
内容来源于网络,如有侵权,请联系作者删除!