It is as you said: if the port is already used it is used. I had the same issue but with axis2 and my services.
When Tomcat is used to go to a SocketHubAppender it catches a port, and this port can no longer be catched by any other logger. So we logged at the next higer level. When Tomcat starts, we create all the loggers and in the various classes we only use the defined loggers. In your case you need to have some ID now from where a log-record comes. And by a filter in Chainsaw-Client you can easy filter out unwanted log-records and only show log-records from a certain test-class at once and in sequence. Josef -----Ursprüngliche Nachricht----- Von: Joern Huxhorn [mailto:[email protected]] Gesendet: Montag, 27. Juni 2011 08:05 An: Log4J Users List Betreff: Re: Help Required with SocketHubReceiver I assume that the other tests won't be able to start a server socket on port 4555 since it is already used by your other test. Try SocketAppender instead. Cheers, Joern. On 27.06.2011, at 06:28, Amit Oberoi wrote: > Is there any way I resolve the below mentioned issue. Not sure whether > my below email makes any sense however I'll be happy to re-word in case > required. > > > > Regards > > > > Amit Oberoi > > > > From: Amit Oberoi > Sent: Friday, June 24, 2011 7:52 PM > To: [email protected] > Subject: 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.============================================================================================================================ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
