You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Amit Oberoi <ao...@TechMahindra.com> on 2011/06/24 16:21:56 UTC

Help Required with SocketHubReceiver

All,

 

I am working on JUnit tests where my tests are executed concurrently.
For each test I am initiating the logger with it class name something
like mentioned below:

 

Logger log = Logger.getLogger(TestCaseName.class)

 

Needless to mention there will be different tests in multiple packages
which are running concurrently.

 

My problem is that if one test is running and is logging using
SocketHubAppender , FileAppender and ConsoleAppender all three attached
to the root logger; logs are captured only for the test which starts
first and the logs for the rest of tests running in parallel are not
shown at all. Tests are initiated via an ANT build file.

 

I am not sure whether I am doing anything wrong over here however would
appreciate any help in resolving this issue.

 

My log4j configuration file looks like below:

 

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

<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<!--

    Document   : LogConfigurations.xml

    Created on : March 29, 2011, 11:09 AM

    Author     : ao0022515

    Description:

        This documents outlines the Log4J configurations for the
Automation project.

-->

 

<log4j:configuration debug="false"
xmlns:log4j="http://jakarta.apache.org/log4j/">

 

    <appender name="socket"
class="org.apache.log4j.net.SocketHubAppender">

        <param name="port" value="4555"/>

        <param name="LocationInfo" value="true"/>

    </appender>

    

    <appender name="console" class="org.apache.log4j.ConsoleAppender">

        <layout class="org.apache.log4j.PatternLayout">

            <param name="ConversionPattern" value="%d{dd MMM yyy
HH:mm:ss, SSS} - %m%n"/>

        </layout>

    </appender>

    

    <appender name="xml" class="org.apache.log4j.FileAppender">

        <param name="File" value="XML_Logs.xml"/>

        <layout class="org.apache.log4j.xml.XMLLayout">

            <param name="LocationInfo" value="true"/>

        </layout>

    </appender>

    

    <root>

        <level value="info"/>

        <appender-ref ref="socket"/>

        <appender-ref ref="console"/>

        <appender-ref ref="xml"/>

    </root>

 

</log4j:configuration>

 

 

Regards

 

Amit Oberoi

 


============================================================================================================================Disclaimer:  This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at <a href="http://www.techmahindra.com/Disclaimer.html">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="http://tim.techmahindra.com/Disclaimer.html">http://tim.techmahindra.com/Disclaimer.html</a> internally within Tech Mahindra.============================================================================================================================