[logback-user] SimpleServerSocket

José Laredo López joselaredo at gmail.com
Fri Nov 8 13:14:10 CET 2013


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?.

This is the code and the configuration file:

Client program:

 * To change this license header, choose License Headers in Project
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
package logbackc;

import java.util.ArrayList;
import java.util.Date;
import java.util.Random;
import java.util.logging.Level;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LogBackC {

     * @param args the command line arguments
    public static void main(String[] args) throws InterruptedException {

        Logger logger = LoggerFactory.getLogger("ABCDEF");
        Integer th = 1;
        Integer pe = 100;

        Random r = new Random();
        for (int i = 0; i < pe; i++) {
            Integer num = r.nextInt(10);
            Boolean war = r.nextBoolean();
            String message= "ABCDEF-" + (war ? "W" : "E") +"-"+ num;
            logger.info("{} {} {}",message, th, i);


Client config file:

<?xml version="1.0" encoding="UTF-8"?>

    <property name="HOSTNAME" value="" />
    <property name="PORT" value="6000" />

    <appender name="SOCKET"

    <root level="INFO">
        <appender-ref ref="SOCKET" />


Server config file:

<?xml version="1.0" encoding="UTF-8"?>
  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
      <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>

  <root level="DEBUG">
    <appender-ref ref="FILE" />

Thank you very much
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20131108/d9220d91/attachment.html>

More information about the Logback-user mailing list