Issue Type: Bug Bug
Affects Versions: 1.0.13
Assignee: Logback dev list
Attachments: LogEvents.java
Components: logback-classic
Created: 26/Jan/14 12:07 PM
Description:

On my machine I noticed that when sending multiple logging events to a SocketAppender, only the first event gets serialized and sent over the wire to a ServerSocketReceiver.

Debuging the code, I found out that for sending loggingEvents the SocketAppender uses either a SynchronousQueue or an ArrayBlockingQueue in order to make producer-consumer and send serialized events to the socket. That BlockingQueue does behave erratically on my machine.

To demonstrate that I included a small java test that will send 3 events to a SynchronousQueue and to an ArrayBlockingQueue and the output is this:

      1. start test SynchronousQueue###
        + appender thread started
  • send 3 events
  • no more events to be sent
    + received event 1
    + appender thread ended
      1. end test ###
      2. start test ArrayBlockingQueue[2]###
        + appender thread started
  • send 3 events
  • no more events to be sent
      1. end test ###
      2. start test ArrayBlockingQueue[3]###
        + appender thread started
  • send 3 events
  • no more events to be sent
    + received event 1
    + received event 2
    + received event 3
    + appender thread ended
      1. end test ###
        This shows that the SynchronousQueue only process the first event and ArrayBlockingQueue[2] does not work at all.

Another test iteration:

      1. start test SynchronousQueue###
        + appender thread started
  • send 3 events
  • no more events to be sent
    + received event 1
    + appender thread ended
      1. end test ###
      2. start test ArrayBlockingQueue[2]###
        + appender thread started
  • send 3 events
  • no more events to be sent
    + received event 1
    + received event 2
    + appender thread ended
      1. end test ###
      2. start test ArrayBlockingQueue[3]###
        + appender thread started
  • send 3 events
  • no more events to be sent
    + received event 1
    + received event 2
    + received event 3
    + appender thread ended
      1. end test ###
        This time the SynchronousQueue only processes the first event and the ArrayBlockingQueue[2] processes the first 2 events.
Environment:

Linux mobile-pc 3.10.17 #2 SMP Wed Oct 23 16:34:38 CDT 2013 x86_64 Intel(R) Core(TM)2 CPU T7200 @ 2.00GHz GenuineIntel GNU/Linux
java version "1.7.0_45"

Project: logback
Priority: Major Major
Reporter: Andrei I
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira