From 191f0de6ee0904298f30d11232e9cfa18f2b51b9 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Tue, 25 Aug 2020 17:22:30 +0200 Subject: [PATCH] Make logging less noisy --- .../channel/uring/AbstractIOUringChannel.java | 16 ++++---- .../netty/channel/uring/IOUringEventLoop.java | 38 +++++++++---------- .../channel/uring/IOUringSubmissionQueue.java | 22 +++++------ 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/transport-native-io_uring/src/main/java/io/netty/channel/uring/AbstractIOUringChannel.java b/transport-native-io_uring/src/main/java/io/netty/channel/uring/AbstractIOUringChannel.java index e568244ae1..e374b7ae71 100644 --- a/transport-native-io_uring/src/main/java/io/netty/channel/uring/AbstractIOUringChannel.java +++ b/transport-native-io_uring/src/main/java/io/netty/channel/uring/AbstractIOUringChannel.java @@ -83,9 +83,9 @@ abstract class AbstractIOUringChannel extends AbstractChannel implements UnixCha } if (parent != null) { - logger.info("Create Channel Socket: {}", socket.intValue()); + logger.trace("Create Channel Socket: {}", socket.intValue()); } else { - logger.info("Create Server Socket: {}", socket.intValue()); + logger.trace("Create Server Socket: {}", socket.intValue()); } } @@ -100,9 +100,9 @@ abstract class AbstractIOUringChannel extends AbstractChannel implements UnixCha } if (parent != null) { - logger.info("Create Channel Socket: {}", socket.intValue()); + logger.trace("Create Channel Socket: {}", socket.intValue()); } else { - logger.info("Create Server Socket: {}", socket.intValue()); + logger.trace("Create Server Socket: {}", socket.intValue()); } } @@ -193,7 +193,7 @@ abstract class AbstractIOUringChannel extends AbstractChannel implements UnixCha @Override protected void doClose() throws Exception { if (parent() == null) { - logger.info("ServerSocket Close: {}", this.socket.intValue()); + logger.trace("ServerSocket Close: {}", this.socket.intValue()); } active = false; // Even if we allow half closed sockets we should give up on reading. Otherwise we may allow a read attempt on a @@ -243,7 +243,7 @@ abstract class AbstractIOUringChannel extends AbstractChannel implements UnixCha // Channel/ChannelHandlerContext.read() was called @Override protected void doBeginRead() { - logger.info("Begin Read"); + logger.trace("Begin Read"); final AbstractUringUnsafe unsafe = (AbstractUringUnsafe) unsafe(); if (!uringInReadyPending) { unsafe.executeUringReadOperator(); @@ -257,7 +257,7 @@ abstract class AbstractIOUringChannel extends AbstractChannel implements UnixCha @Override protected void doWrite(ChannelOutboundBuffer in) throws Exception { - logger.info("IOUring doWrite message size: {}", in.size()); + logger.trace("IOUring doWrite message size: {}", in.size()); if (writeable && in.size() >= 1) { Object msg = in.current(); if (msg instanceof ByteBuf) { @@ -396,7 +396,7 @@ abstract class AbstractIOUringChannel extends AbstractChannel implements UnixCha } void shutdownInput(boolean rdHup) { - logger.info("shutdownInput Fd: {}", this.socket.intValue()); + logger.trace("shutdownInput Fd: {}", this.socket.intValue()); if (!socket.isInputShutdown()) { if (isAllowHalfClosure(config())) { try { diff --git a/transport-native-io_uring/src/main/java/io/netty/channel/uring/IOUringEventLoop.java b/transport-native-io_uring/src/main/java/io/netty/channel/uring/IOUringEventLoop.java index 3c8f5be90c..c05013da72 100644 --- a/transport-native-io_uring/src/main/java/io/netty/channel/uring/IOUringEventLoop.java +++ b/transport-native-io_uring/src/main/java/io/netty/channel/uring/IOUringEventLoop.java @@ -75,25 +75,25 @@ final class IOUringEventLoop extends SingleThreadEventLoop { addNewEvent(event); ringBuffer.getIoUringSubmissionQueue().addPoll(eventId, eventfd.intValue(), event.getOp()); ringBuffer.getIoUringSubmissionQueue().submit(); - logger.info("New EventLoop: {}", this.toString()); + logger.trace("New EventLoop: {}", this.toString()); } public long incrementEventIdCounter() { long eventId = eventIdCounter; - logger.info("incrementEventIdCounter EventId: {}", eventId); + logger.trace("incrementEventIdCounter EventId: {}", eventId); eventIdCounter++; return eventId; } public void add(AbstractIOUringChannel ch) { - logger.info("Add Channel: {} ", ch.socket.intValue()); + logger.trace("Add Channel: {} ", ch.socket.intValue()); int fd = ch.socket.intValue(); channels.put(fd, ch); } public void remove(AbstractIOUringChannel ch) { - logger.info("Remove Channel: {}", ch.socket.intValue()); + logger.trace("Remove Channel: {}", ch.socket.intValue()); int fd = ch.socket.intValue(); AbstractIOUringChannel old = channels.remove(fd); @@ -107,7 +107,7 @@ final class IOUringEventLoop extends SingleThreadEventLoop { } private void closeAll() { - logger.info("CloseAll IOUringEvenloop"); + logger.trace("CloseAll IOUringEvenloop"); // Using the intermediate collection to prevent ConcurrentModificationException. // In the `close()` method, the channel is deleted from `channels` map. AbstractIOUringChannel[] localChannels = channels.values().toArray(new AbstractIOUringChannel[0]); @@ -126,7 +126,7 @@ final class IOUringEventLoop extends SingleThreadEventLoop { final IOUringCompletionQueue completionQueue = ringBuffer.getIoUringCompletionQueue(); final IOUringSubmissionQueue submissionQueue = ringBuffer.getIoUringSubmissionQueue(); for (;;) { - logger.info("Run IOUringEventLoop {}", this.toString()); + logger.trace("Run IOUringEventLoop {}", this.toString()); long curDeadlineNanos = nextScheduledTaskDeadlineNanos(); if (curDeadlineNanos == -1L) { curDeadlineNanos = NONE; // nothing on the calendar @@ -150,7 +150,7 @@ final class IOUringEventLoop extends SingleThreadEventLoop { } // Block if there is nothing to process. - logger.debug("ioUringWaitCqe {}", this.toString()); + logger.trace("ioUringWaitCqe {}", this.toString()); ioUringCqe = completionQueue.ioUringWaitCqe(); } finally { @@ -160,7 +160,7 @@ final class IOUringEventLoop extends SingleThreadEventLoop { } } else { // Just poll as there are tasks to process so we don't want to block. - logger.debug("poll {}", this.toString()); + logger.trace("poll {}", this.toString()); ioUringCqe = completionQueue.poll(); } @@ -168,14 +168,14 @@ final class IOUringEventLoop extends SingleThreadEventLoop { final Event event = events.get(ioUringCqe.getEventId()); if (event != null) { - logger.debug("EventType Incoming: " + event.getOp().name()); + logger.trace("EventType Incoming: " + event.getOp().name()); processEvent(ioUringCqe.getRes(), event); } // Process one entry after the other until there are none left. This will ensure we process // all of these before we try to consume tasks. ioUringCqe = completionQueue.poll(); - logger.debug("poll {}", this.toString()); + logger.trace("poll {}", this.toString()); } if (hasTasks()) { @@ -199,13 +199,13 @@ final class IOUringEventLoop extends SingleThreadEventLoop { IOUringSubmissionQueue submissionQueue = ringBuffer.getIoUringSubmissionQueue(); switch (event.getOp()) { case ACCEPT: - logger.info("EventLoop Accept filedescriptor: {}", res); + logger.trace("EventLoop Accept filedescriptor: {}", res); event.getAbstractIOUringChannel().setUringInReadyPending(false); if (res != -1 && res != ERRNO_EAGAIN_NEGATIVE && res != ERRNO_EWOULDBLOCK_NEGATIVE) { AbstractIOUringServerChannel abstractIOUringServerChannel = (AbstractIOUringServerChannel) event.getAbstractIOUringChannel(); - logger.info("server filedescriptor Fd: {}", abstractIOUringServerChannel.getSocket().intValue()); + logger.trace("server filedescriptor Fd: {}", abstractIOUringServerChannel.getSocket().intValue()); final IOUringRecvByteAllocatorHandle allocHandle = (IOUringRecvByteAllocatorHandle) event.getAbstractIOUringChannel().unsafe() .recvBufAllocHandle(); @@ -239,8 +239,8 @@ final class IOUringEventLoop extends SingleThreadEventLoop { .recvBufAllocHandle(); final ChannelPipeline pipeline = event.getAbstractIOUringChannel().pipeline(); try { - logger.info("EventLoop Read Res: {}", res); - logger.info("EventLoop Fd: {}", event.getAbstractIOUringChannel().getSocket().intValue()); + logger.trace("EventLoop Read Res: {}", res); + logger.trace("EventLoop Fd: {}", event.getAbstractIOUringChannel().getSocket().intValue()); event.getAbstractIOUringChannel().setUringInReadyPending(false); byteBuf = event.getReadBuffer(); if (localReadAmount > 0) { @@ -268,7 +268,7 @@ final class IOUringEventLoop extends SingleThreadEventLoop { allocHandle.readComplete(); pipeline.fireChannelReadComplete(); - logger.info("READ autoRead {}", event.getAbstractIOUringChannel().config().isAutoRead()); + logger.trace("READ autoRead {}", event.getAbstractIOUringChannel().config().isAutoRead()); if (event.getAbstractIOUringChannel().config().isAutoRead()) { event.getAbstractIOUringChannel().executeReadEvent(); } @@ -278,8 +278,8 @@ final class IOUringEventLoop extends SingleThreadEventLoop { break; case WRITE: //localFlushAmount -> res - logger.info("EventLoop Write Res: {}", res); - logger.info("EventLoop Fd: {}", event.getAbstractIOUringChannel().getSocket().intValue()); + logger.trace("EventLoop Write Res: {}", res); + logger.trace("EventLoop Fd: {}", event.getAbstractIOUringChannel().getSocket().intValue()); ChannelOutboundBuffer channelOutboundBuffer = event .getAbstractIOUringChannel().unsafe().outboundBuffer(); AbstractIOUringChannel channel = event.getAbstractIOUringChannel(); @@ -318,7 +318,7 @@ final class IOUringEventLoop extends SingleThreadEventLoop { break; case POLL_LINK: //Todo error handling error - logger.info("POLL_LINK Res: {}", res); + logger.trace("POLL_LINK Res: {}", res); break; case POLL_RDHUP: if (!event.getAbstractIOUringChannel().isActive()) { @@ -326,7 +326,7 @@ final class IOUringEventLoop extends SingleThreadEventLoop { } break; case POLL_OUT: - logger.info("POLL_OUT Res: {}", res); + logger.trace("POLL_OUT Res: {}", res); break; } this.events.remove(event.getId()); diff --git a/transport-native-io_uring/src/main/java/io/netty/channel/uring/IOUringSubmissionQueue.java b/transport-native-io_uring/src/main/java/io/netty/channel/uring/IOUringSubmissionQueue.java index b9d9f71a60..09c36fcc3a 100644 --- a/transport-native-io_uring/src/main/java/io/netty/channel/uring/IOUringSubmissionQueue.java +++ b/transport-native-io_uring/src/main/java/io/netty/channel/uring/IOUringSubmissionQueue.java @@ -104,7 +104,7 @@ final class IOUringSubmissionQueue { sqeTail = next; } if (sqe == 0) { - logger.info("sqe is null"); + logger.trace("sqe is null"); } return sqe; } @@ -142,11 +142,11 @@ final class IOUringSubmissionQueue { offsetIndex += 8; } - logger.info("OPField: {}", type.name()); - logger.info("UserDataField: {}", PlatformDependent.getLong(sqe + SQE_USER_DATA_FIELD)); - logger.info("BufferAddress: {}", PlatformDependent.getLong(sqe + SQE_ADDRESS_FIELD)); - logger.info("Length: {}", PlatformDependent.getInt(sqe + SQE_LEN_FIELD)); - logger.info("Offset: {}", PlatformDependent.getLong(sqe + SQE_OFFSET_FIELD)); + logger.trace("OPField: {}", type.name()); + logger.trace("UserDataField: {}", PlatformDependent.getLong(sqe + SQE_USER_DATA_FIELD)); + logger.trace("BufferAddress: {}", PlatformDependent.getLong(sqe + SQE_ADDRESS_FIELD)); + logger.trace("Length: {}", PlatformDependent.getInt(sqe + SQE_LEN_FIELD)); + logger.trace("Offset: {}", PlatformDependent.getLong(sqe + SQE_OFFSET_FIELD)); } public boolean addTimeout(long nanoSeconds, long eventId) { @@ -200,10 +200,10 @@ final class IOUringSubmissionQueue { long kHead = toUnsignedLong(PlatformDependent.getIntVolatile(kHeadAddress)); long kRingMask = toUnsignedLong(PlatformDependent.getInt(kRingMaskAddress)); - logger.info("Ktail: {}", kTail); - logger.info("Ktail: {}", kHead); - logger.info("SqeHead: {}", sqeHead); - logger.info("SqeTail: {}", sqeTail); + logger.trace("Ktail: {}", kTail); + logger.trace("Ktail: {}", kHead); + logger.trace("SqeHead: {}", sqeHead); + logger.trace("SqeTail: {}", sqeTail); if (sqeHead == sqeTail) { return (int) (kTail - kHead); @@ -228,7 +228,7 @@ final class IOUringSubmissionQueue { public void submit() { int submitted = flushSqe(); - logger.info("Submitted: {}", submitted); + logger.trace("Submitted: {}", submitted); int ret = Native.ioUringEnter(ringFd, submitted, 0, 0); if (ret < 0) {