[logback-user] SocketAppender Public IP

Aleksandar Stefanovic stefanovical at gmail.com
Wed Apr 24 12:51:02 CEST 2013

Hi David,

I will explain my problem in more details. I am using logback 1.0.7 and 
slf4j 1.7.5. For building, I use Eclipse IDE, one simple test program to 
log message and logback.xml as configuration file for parameters. This 
is how logback.xml looks like.

<?xml version="1.0" encoding="UTF-8"?>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
       <pattern>%date [%thread] %level %logger{15} %msg%n</pattern>
<appender name="SOCKET" class="ch.qos.logback.classic.net.SocketAppender">
<root level="debug">
      <appender-ref ref="FILE" />
     <appender-ref ref="SOCKET" />

For testing purpose I use ch.qos.logback.classic.net.SimpleSocketServer, 
passing 2 arguments as shown on site ie. /java 
ch.qos.logback.classic.net.SimpleSocketServer 6000 
src/main/java/chapters/appenders/socket/server1.xml/. When localhost is 
in the place, the messages are sent without problems to server. Also, 
tested with IP address of another computer in my LAN where I started 
SimpleSocketServer on that address and also messages are sent without 
problems. So, the actual problem is when there is some public IP address 
(i want to send to remote office's server) in remoteHost, building 
simple stop with executing in Eclipse.
By setting /debug="true"/ attribute of /configuration/ tag in xml and 
when there is localhost as remoteHost address  I got this:
12:28:41,172 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - 
About to instantiate appender of type 
12:28:41,176 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - 
Naming appender as [SOCKET]
12:28:41,197 |-INFO in ch.qos.logback.classic.net.SocketAppender[SOCKET] 
- Starting a new connector thread.
12:28:41,199 |-INFO in ch.qos.logback.classic.net.SocketAppender[SOCKET] 
- Could not connect to remote logback server at [localhost]. We will try 
again later. java.net.ConnectException: Connection refused
     at java.net.ConnectException: Connection refused

which basically means waiting for server to be up again and will try 
later to send log message, and running application continues with 
executing anyway.

But if I put IP address of remote server, process paused here:
12:41:35,234 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - 
About to instantiate appender of type 
12:41:35,239 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - 
Naming appender as [SOCKET]

What caused that to happens? Is possibly at all to send socket messages 
to remote server IP address and how I can achieve it?


On 24.04.2013. 10:40, David Roussel wrote:
> Hi,
> It's not clear what your question is. Is something not working? Are you asking what is the best way to configure it?
> What version of logback are you using. And what does your logback.xml look like?
> David
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130424/3bd8e543/attachment.html>

More information about the Logback-user mailing list