That, or not run the tests multi-threaded... since most of the bugs will be in the tests.
Gary On Wed, May 21, 2014 at 3:44 PM, Matt Sicker <[email protected]> wrote: > I'll get around to those eventually, but the InitialLoggerContext JUnit > rule helps automate all of this. In order to make it work with > multithreaded testing (which is another surefire option), you can use it as > a @Rule instead of a @ClassRule, but that does mean reconfiguring a > LoggerContext for every single test. > > ---------- Forwarded message ---------- > From: <[email protected]> > Date: 21 May 2014 13:33 > Subject: svn commit: r1596645 - in > /logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j: > LoggerTest.java OptionalTest.java SerializeTest.java > To: [email protected] > > > Author: ggregory > Date: Wed May 21 18:33:31 2014 > New Revision: 1596645 > > URL: http://svn.apache.org/r1596645 > Log: > This hack makes it such that all the test classes in this package can be > executed in any order in a test suite (like from Eclipse). > > Modified: > > logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java > > logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/OptionalTest.java > > logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/SerializeTest.java > > Modified: > logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java > URL: > http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java?rev=1596645&r1=1596644&r2=1596645&view=diff > > ============================================================================== > --- > logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java > (original) > +++ > logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java > Wed May 21 18:33:31 2014 > @@ -54,6 +54,7 @@ public class LoggerTest { > public static void setupClass() { > > System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, > CONFIG); > ctx = (LoggerContext) LogManager.getContext(false); > + ctx.reconfigure(); > ctx.getConfiguration(); > } > > > Modified: > logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/OptionalTest.java > URL: > http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/OptionalTest.java?rev=1596645&r1=1596644&r2=1596645&view=diff > > ============================================================================== > --- > logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/OptionalTest.java > (original) > +++ > logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/OptionalTest.java > Wed May 21 18:33:31 2014 > @@ -50,6 +50,7 @@ public class OptionalTest { > public static void setupClass() { > > System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, > CONFIG); > ctx = (LoggerContext) LogManager.getContext(false); > + ctx.reconfigure(); > ctx.getConfiguration(); > } > > > Modified: > logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/SerializeTest.java > URL: > http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/SerializeTest.java?rev=1596645&r1=1596644&r2=1596645&view=diff > > ============================================================================== > --- > logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/SerializeTest.java > (original) > +++ > logging/log4j/log4j2/trunk/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/SerializeTest.java > Wed May 21 18:33:31 2014 > @@ -48,6 +48,7 @@ public class SerializeTest { > public static void setupClass() { > > System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, > CONFIG); > ctx = (LoggerContext) LogManager.getContext(false); > + ctx.reconfigure(); > ctx.getConfiguration(); > } > > > > > > > -- > Matt Sicker <[email protected]> > -- E-Mail: [email protected] | [email protected] Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> Spring Batch in Action <http://www.manning.com/templier/> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory
