Which exception are you seeing? That block of code could throw about 5 different exceptions. Can you post the actual exception and traceback?
Sent from AT&T Yahoo Mail on Android On Tue, May 10, 2022 at 5:19 AM, EDMONDO SENA<edse...@gmail.com> wrote: Hi all, I am sending the logs of my subsystems to the SyslogServer but I see that the following exception is raised in TCPSocketManager. Could you help me understand why? I am using log4j 2.17 and syslog0.9.46. The exception is this line 243 of the TCPSocketManager class: 206 @SuppressWarnings("sync-override") // synchronization on "this" is done within the method207 @Override208 protected void write(final byte[] bytes, final int offset, final int length, final boolean immediateFlush) {209 if (socket == null) {210 if (reconnector != null && !immediateFail) {211 reconnector.latch();212 }213 if (socket == null) {214 throw new AppenderLoggingException("Error writing to " + getName() + ": socket not available");215 }216 }217 synchronized (this) {218 try {219 writeAndFlush(bytes, offset, length, immediateFlush);220 } catch (final IOException causeEx) {221 final String config = inetAddress + ":" + port;222 if (retry && reconnector == null) {223 reconnector = createReconnector();224 try {225 reconnector.reconnect();226 } catch (final IOException reconnEx) {227 LOGGER.debug("Cannot reestablish socket connection to {}: {}; starting reconnector thread {}",228 config, reconnEx.getLocalizedMessage(), reconnector.getName(), reconnEx);229 reconnector.start();230 throw new AppenderLoggingException(231 String.format("Error sending to %s for %s", getName(), config), causeEx);232 }233 try {234 writeAndFlush(bytes, offset, length, immediateFlush);235 } catch (final IOException e) {236 throw new AppenderLoggingException(237 String.format("Error writing to %s after reestablishing connection for %s", getName(),238 config),239 causeEx);240 }241 return;242 }243 final String message = String.format("Error writing to %s for connection %s", getName(), config);244 throw new AppenderLoggingException(message, causeEx);245 }246 }247 } Thanks in advance. //Edmondo.