[logback-user] SocketAppender and ServerSocketReceiver

Scott Dudley scott at telesoft.com
Sat Aug 10 00:10:24 CEST 2013


I'm attempting to update my logback configuration to support client 
connections to my main logger via separate, command-line JVM's using 
another configuration file.  I'm having only limited success.

My biggest problem currently is that the client connections often write 
no more than the first log entry to the server.

Would very much appreciate some help.

My server's logback.xml is as follows:

    <configuration scan="true" scanPeriod="30 seconds">

       <statusListener
    class="ch.qos.logback.core.status.OnConsoleStatusListener" />

       <conversionRule conversionWord="appName"
    converterClass="com.telesoft.web.LogbackJNDIContextConverter" />

       <appender name="FILE"
    class="ch.qos.logback.core.rolling.RollingFileAppender">
         <file>${catalina.home}/logs/debug.log</file>

         <rollingPolicy
    class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
    <fileNamePattern>${catalina.home}/logs/debug%i.log</fileNamePattern>
           <minIndex>1</minIndex>
           <maxIndex>5</maxIndex>
         </rollingPolicy>

         <triggeringPolicy
    class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
           <maxFileSize>15MB</maxFileSize>
         </triggeringPolicy>

         <encoder>
            <pattern>%d{MM/dd
    HH:mm:ss.SSS}|%thread|%X{sessionUserName}|%-5level|%X{debugLevel}|%logger|%replace(%msg%n%ex){'[\n\r]+',
    '~~~'}|%appName{}%n%nopex</pattern>
         </encoder>
       </appender>

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

       <if condition='isNull("SERVERSOCKETRECEIVERRUNNING")'>
         <then>
           <receiver
    class="ch.qos.logback.classic.net.server.ServerSocketReceiver">
             <port>3636</port>
           </receiver>
         </then>
       </if>
    </configuration>

And the client xml thus:

    <configuration>

       <appender name="SOCKET"
    class="ch.qos.logback.classic.net.SocketAppender">
         <remoteHost>127.0.0.1</remoteHost>
         <port>3636</port>
       </appender>

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

    </configuration>

-- 

Scott Dudley | Senior Developer

Telesoft | 1661 E. Camelback Road, Suite 300 | Phoenix, AZ 85016
P: 602.308.1115 | F: 602.308.1300 | W: www.telesoft.com 
<http://www.telesoft.com/?utm_source=signature&utm_medium=email&utm_campaign=2012>

TEM Edge Blog 
<http://www.telesoft.com/blog?utm_source=signature&utm_medium=email&utm_campaign=2012> 
| LinkedIn <http://www.linkedin.com/company/telesoft-corp.> | Twitter 
<http://www.twitter.com/_Telesoft>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130809/00e094d2/attachment.html>


More information about the Logback-user mailing list