[logback-user] SocketAppender Public IP

Ross Sargant rsargant at tvrc.com
Wed Apr 24 14:34:46 CEST 2013


That has more to do with your networking & firewall configuration then
logback.   Logback is probably blocking when it tries to establish the
connection to <remote server ip>.  <remote server ip> is neither granting
nor denying the connection.

Try testing out the TCP connectivity to the remote logback server outside
of logback  (*telnet <remote server ip> 6000*)  from the same machine you
are experiencing this issue.  If that doesn't work, logback can't be
expected to work either and you'd need to work out the networking/firewall
issues before worrying about logback.



On Wed, Apr 24, 2013 at 6:51 AM, Aleksandar Stefanovic <
stefanovical at gmail.com> wrote:

>  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"?>
> <configuration>
> <appender name="FILE" class="ch.qos.logback.core.FileAppender">
>     <file>myApp.log</file>
>     <encoder>
>       <pattern>%date [%thread] %level %logger{15} %msg%n</pattern>
>     </encoder>
>   </appender>
> <appender name="SOCKET" class="ch.qos.logback.classic.net.SocketAppender">
>     <remoteHost>localhost</remoteHost>
>     <port>6000</port>
>     <reconnectionDelay>10000</reconnectionDelay>
>     <includeCallerData>true</includeCallerData>
>   </appender>
> <root level="debug">
>      <appender-ref ref="FILE" />
>     <appender-ref ref="SOCKET" />
>  </root>
> </configuration>
>
> 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
> [ch.qos.logback.classic.net.SocketAppender]
> 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
> [ch.qos.logback.classic.net.SocketAppender]
> 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?
>
>
> Aleksandar
>
>
>
> 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 listLogback-user at qos.chhttp://mailman.qos.ch/mailman/listinfo/logback-user
>
>
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>



-- 
Ross Sargant
Software Engineer
p: 954-796-2592
email: rsargant at tvrc.com

TVR Communications LLC
541 S. State Road 7,Suite 5,Margate, Florida,33068

http://www.tvrc.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130424/947e2c71/attachment-0001.html>


More information about the Logback-user mailing list