本文整理汇总了Java中io.netty.util.internal.logging.InternalLogLevel类的典型用法代码示例。如果您正苦于以下问题:Java InternalLogLevel类的具体用法?Java InternalLogLevel怎么用?Java InternalLogLevel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InternalLogLevel类属于io.netty.util.internal.logging包,在下文中一共展示了InternalLogLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logMethodCall
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
public static void logMethodCall(Object object, String methodName, Object[] arguments) {
String className = getClassName(object);
String logname = "methodCalls." + className + "." + methodName;
InternalLogger objLog = InternalLoggerFactory.getInstance(logname);
if (!objLog.isTraceEnabled()) return;
StringBuilder msg = new StringBuilder(methodName);
msg.append("(");
if (arguments != null) {
for (int i = 0; i < arguments.length;) {
msg.append(normalizedValue(arguments[i]));
if (++i < arguments.length) {
msg.append(",");
}
}
}
msg.append(")");
objLog.log(InternalLogLevel.TRACE, className, msg.toString(), "called from MetaClass.invokeMethod");
}
示例2: fromInternal
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
private Level fromInternal(final InternalLogLevel level)
{
switch (level)
{
case TRACE:
return Level.TRACE;
case DEBUG:
return Level.DEBUG;
case INFO:
return Level.INFO;
case WARN:
return Level.WARN;
case ERROR:
return Level.ERROR;
default:
return null;
}
}
示例3: isEnabled
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
@Override
public boolean isEnabled(InternalLogLevel level) {
if (level == null) {
return false;
}
switch (level) {
case TRACE:
return logger.isTraceEnabled();
case DEBUG:
return logger.isDebugEnabled();
case INFO:
return logger.isInfoEnabled();
case WARN:
return logger.isWarnEnabled();
case ERROR:
return logger.isErrorEnabled();
}
return false;
}
示例4: log
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
@Override
public void log(InternalLogLevel level, String msg) {
if (level == null) {
return;
}
switch (level) {
case TRACE:
trace(msg);
break;
case DEBUG:
debug(msg);
break;
case INFO:
info(msg);
break;
case WARN:
warn(msg);
break;
case ERROR:
error(msg);
break;
}
}
示例5: SpdyFrameLogger
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
public SpdyFrameLogger(InternalLogLevel level) {
if (level == null) {
throw new NullPointerException("level");
}
logger = InternalLoggerFactory.getInstance(getClass());
this.level = level;
}
示例6: LoggingHandler
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
/**
* Creates a new instance whose logger name is the fully qualified class
* name of the instance.
*
* @param level the log level
*/
public LoggingHandler(LogLevel level) {
if (level == null) {
throw new NullPointerException("level");
}
logger = InternalLoggerFactory.getInstance(getClass());
this.level = level;
internalLevel = InternalLogLevel.DEBUG;
}
示例7: exceptionCaught
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
InternalLogLevel logLevel = InternalLogLevel.WARN;
if (!stack.isEmpty()) {
RedisCommand<K, V, ?> command = stack.poll();
if (debugEnabled) {
logger.debug("{} Storing exception in {}", logPrefix(), command);
}
logLevel = InternalLogLevel.DEBUG;
try {
command.completeExceptionally(cause);
} catch (Exception ex) {
logger.warn("{} Unexpected exception during command completion exceptionally: {}", logPrefix, ex.toString(), ex);
}
}
if (channel == null || !channel.isActive() || !isConnected()) {
if (debugEnabled) {
logger.debug("{} Storing exception in connectionError", logPrefix());
}
logLevel = InternalLogLevel.DEBUG;
connectionError = cause;
}
if (cause instanceof IOException && logLevel.ordinal() > InternalLogLevel.INFO.ordinal()) {
logLevel = InternalLogLevel.INFO;
if (SUPPRESS_IO_EXCEPTION_MESSAGES.contains(cause.getMessage())) {
logLevel = InternalLogLevel.DEBUG;
}
}
logger.log(logLevel, "{} Unexpected exception during request: {}", logPrefix, cause.toString(), cause);
}
示例8: operationComplete
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void operationComplete(Future<Void> future) throws Exception {
Throwable cause = future.cause();
boolean success = future.isSuccess();
dequeue();
if (!success) {
if (cause instanceof EncoderException || cause instanceof Error || cause.getCause() instanceof Error) {
complete(cause);
return;
}
Channel channel = CommandHandler.this.channel;
if (channel != null) {
channel.eventLoop().submit(this::requeueCommands);
} else {
CommandHandler.this.clientResources.eventExecutorGroup().submit(this::requeueCommands);
}
}
if (!success && !(cause instanceof ClosedChannelException)) {
String message = "Unexpected exception during request: {}";
InternalLogLevel logLevel = InternalLogLevel.WARN;
if (cause instanceof IOException && SUPPRESS_IO_EXCEPTION_MESSAGES.contains(cause.getMessage())) {
logLevel = InternalLogLevel.DEBUG;
}
logger.log(logLevel, message, cause.toString(), cause);
}
}
示例9: getLogLevel
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
public final InternalLogLevel getLogLevel() {
return logLevel;
}
示例10: setLogLevel
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
public final void setLogLevel(InternalLogLevel logLevel) {
if(logLevel!=null)
{
this.logLevel = logLevel;
}
}
示例11: isEnabled
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
@Override
public boolean isEnabled(final InternalLogLevel level)
{
return logger.isEnabled(fromInternal(level));
}
示例12: log
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
@Override
public void log(final InternalLogLevel level, final String msg)
{
logger.log(fromInternal(level), msg);
}
示例13: run
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
/**
* Reconnect to the remote address that the closed channel was connected to. This creates a new {@link ChannelPipeline} with
* the same handler instances contained in the old channel's pipeline.
*
* @param timeout Timer task handle.
*
* @throws Exception when reconnection fails.
*/
@Override
public void run(Timeout timeout) throws Exception {
reconnectSchedulerSync.set(false);
reconnectScheduleTimeout = null;
if (!isEventLoopGroupActive()) {
logger.debug("isEventLoopGroupActive() == false");
return;
}
if (commandHandler != null && commandHandler.isClosed()) {
logger.debug("Skip reconnect scheduling, CommandHandler is closed");
return;
}
if (isReconnectSuspended()) {
logger.debug("Skip reconnect scheduling, reconnect is suspended");
return;
}
boolean shouldLog = shouldLog();
InternalLogLevel infoLevel = InternalLogLevel.INFO;
InternalLogLevel warnLevel = InternalLogLevel.WARN;
if (shouldLog) {
lastReconnectionLogging = System.currentTimeMillis();
} else {
warnLevel = InternalLogLevel.DEBUG;
infoLevel = InternalLogLevel.DEBUG;
}
InternalLogLevel warnLevelToUse = warnLevel;
try {
reconnectionListener.onReconnect(new ConnectionEvents.Reconnect(attempts));
logger.log(infoLevel, "Reconnecting, last destination was {}", remoteAddress);
ChannelFuture future = reconnectionHandler.reconnect();
future.addListener(it -> {
if (it.isSuccess() || it.cause() == null) {
return;
}
Throwable throwable = it.cause();
if (ReconnectionHandler.isExecutionException(throwable)) {
logger.log(warnLevelToUse, "Cannot reconnect: {}", throwable.toString());
} else {
logger.log(warnLevelToUse, "Cannot reconnect: {}", throwable.toString(), throwable);
}
if (!isReconnectSuspended()) {
scheduleReconnect();
}
});
} catch (Exception e) {
logger.log(warnLevel, "Cannot reconnect: {}", e.toString());
}
}
示例14: isEnabled
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
@Override
public boolean isEnabled(InternalLogLevel level) {
return delegate.isEnabled(level);
}
示例15: log
import io.netty.util.internal.logging.InternalLogLevel; //导入依赖的package包/类
@Override
public void log(InternalLogLevel level, String msg) {
if (level == InternalLogLevel.ERROR)
incrementLeak();
delegate.log(level, msg);
}