Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1212

Configuration with multiple SocketReceiver does not work

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.1.7
    • logback-classic

    Description

      With configuration like this:

      <?xml version="1.0" encoding="UTF-8"?>
      <configuration debug="true">
          <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
              <encoder>
                  <Pattern>%d{ISO8601} %-5level %property{HOSTNAME} %property{APP} [%thread] %logger{36} - %msg%n</Pattern>
              </encoder>
          </appender>
          
          <logger name="_3e.pl.HubApp" level="DEBUG" additivity="false">
              <appender-ref ref="STDOUT" />
          </logger>
          
          <root level="info">
              <appender-ref ref="STDOUT" />
          </root>
      
          <receiver class="ch.qos.logback.classic.net.SocketReceiver">
              <remoteHost>127.0.0.1</remoteHost>
              <port>8888</port>
              <reconnectionDelay>1000</reconnectionDelay>
          </receiver>
      
          <receiver class="ch.qos.logback.classic.net.SocketReceiver">
              <remoteHost>127.0.0.1</remoteHost>
              <port>8888</port>
              <reconnectionDelay>1000</reconnectionDelay>
          </receiver>
      </configuration>
      

      logback is not showing any logs from remote app(s) and no "connection established" trace. When I provide only one <receiver> it works as expected. I am using two connection to same test app producing log every 5sec only for PoC, configuration with two different targets does not work as well. Debug output is:

      14:58:44,648 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
      14:58:44,648 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
      14:58:44,648 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/project/examplesrv/target/classes/logback.xml]
      14:58:44,894 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
      14:58:44,909 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
      14:58:44,941 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
      14:58:45,003 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [_3e.pl.HubApp] to DEBUG
      14:58:45,003 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [_3e.pl.HubApp] to false
      14:58:45,003 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[_3e.pl.HubApp]
      14:58:45,003 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
      14:58:45,003 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
      14:58:45,003 |-INFO in ch.qos.logback.classic.joran.action.ReceiverAction - About to instantiate receiver of type [ch.qos.logback.classic.net.SocketReceiver]
      14:58:45,019 |-INFO in ch.qos.logback.classic.joran.action.ReceiverAction - About to instantiate receiver of type [ch.qos.logback.classic.net.SocketReceiver]
      14:58:45,019 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
      14:58:45,034 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@3439f68d - Registering current configuration as safe fallback point
      2016-10-07 14:58:45,034 DEBUG 01-00488-201607 null [main] _3e.pl.HubApp - Starting...
      

      last line is from my app. When I provide only one <receiver> I get:

      15:02:51,999 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
      15:02:51,999 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
      15:02:51,999 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/project/examplesrv/target/classes/logback.xml]
      15:02:52,264 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
      15:02:52,264 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
      15:02:52,280 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
      15:02:52,342 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [_3e.pl.HubApp] to DEBUG
      15:02:52,342 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [_3e.pl.HubApp] to false
      15:02:52,342 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[_3e.pl.HubApp]
      15:02:52,342 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
      15:02:52,342 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
      15:02:52,342 |-INFO in ch.qos.logback.classic.joran.action.ReceiverAction - About to instantiate receiver of type [ch.qos.logback.classic.net.SocketReceiver]
      15:02:52,358 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
      15:02:52,374 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@60438a68 - Registering current configuration as safe fallback point
      2016-10-07 15:02:52,374 DEBUG 01-00488-201607 null [main] _3e.pl.HubApp - Starting...
      15:02:52,485 |-INFO in ch.qos.logback.classic.net.SocketReceiver@7e9a5fbe - receiver 127.0.0.1:8888: connection established
      

      and then logs from remote app start to appear (notice "connection established INFO")...

      Attachments

        Activity

          People

            logback-dev Logback dev list
            mlizewski Maciej Lizewski
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: