<div dir="ltr"><br clear="all"><div>Hi,</div><div><br></div><div>I'm trying to connect to a SimpleServerSocket like the example in the documentation with a SocketAppender. If I send messages continuosly, the server don't receive the messages. If the client programs sends the messages with a sleep, the server receives the message correctly. Can you help me?.</div>
<div><br></div><div>This is the code and the configuration file:</div><div><br></div><div>Client program:</div><div><br></div><div><div>/*</div><div> * To change this license header, choose License Headers in Project Properties.</div>
<div> * To change this template file, choose Tools | Templates</div><div> * and open the template in the editor.</div><div> */</div><div>package logbackc;</div><div><br></div><div>import java.util.ArrayList;</div><div>import java.util.Date;</div>
<div>import java.util.Random;</div><div>import java.util.logging.Level;</div><div>import org.slf4j.Logger;</div><div>import org.slf4j.LoggerFactory;</div><div><br></div><div>public class LogBackC {</div><div><br></div><div>
/**</div><div> * @param args the command line arguments</div><div> */</div><div> public static void main(String[] args) throws InterruptedException {</div><div><br></div><div> Logger logger = LoggerFactory.getLogger("ABCDEF");</div>
<div> Integer th = 1;</div><div> Integer pe = 100;</div><div> </div><div> Random r = new Random();</div><div> for (int i = 0; i < pe; i++) {</div><div> Integer num = r.nextInt(10);</div>
<div> Boolean war = r.nextBoolean();</div><div> String message= "ABCDEF-" + (war ? "W" : "E") +"-"+ num;</div><div> <a href="http://logger.info">logger.info</a>("{} {} {}",message, th, i);</div>
<div> </div><div> }</div><div> }</div><div>}</div></div><div><br></div><div>Client config file:</div><div><br></div><div><div><?xml version="1.0" encoding="UTF-8"?></div><div><configuration><br>
</div><div> </div><div> <property name="HOSTNAME" value="127.0.0.1" /></div><div> <property name="PORT" value="6000" /></div><div> </div><div> <appender name="SOCKET" class="ch.qos.logback.classic.net.SocketAppender"></div>
<div> <remoteHost>${HOSTNAME}</remoteHost></div><div> <port>${PORT}</port></div><div> <reconnectionDelay>10000</reconnectionDelay></div><div> <includeCallerData>false</includeCallerData></div>
<div> </appender></div><div><br></div><div> <root level="INFO"></div><div> <appender-ref ref="SOCKET" /></div><div> </root> </div><div><br></div><div></configuration></div>
</div><div><br></div><div>Server config file:</div><div><br></div><div><div><?xml version="1.0" encoding="UTF-8"?></div><div><configuration><span class="" style="white-space:pre"> </span></div>
<div> <appender name="FILE" class="ch.qos.logback.core.FileAppender"></div><div> <file>testFile.log</file></div><div> <append>true</append></div><div> <encoder></div>
<div> <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern></div><div> </encoder></div><div> </appender></div><div><br></div><div> <root level="DEBUG"></div>
<div> <appender-ref ref="FILE" /></div><div> </root></div><div></configuration></div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>Thank you very much</div>
<div><br></div>
</div>