diff --git a/akka-durable-mailboxes/akka-zookeeper-mailbox/src/test/resources/log4j.properties b/akka-durable-mailboxes/akka-zookeeper-mailbox/src/test/resources/log4j.properties new file mode 100644 index 0000000000..2d07c8e051 --- /dev/null +++ b/akka-durable-mailboxes/akka-zookeeper-mailbox/src/test/resources/log4j.properties @@ -0,0 +1,58 @@ +# Define some default values that can be overridden by system properties +zookeeper.root.logger=INFO, CONSOLE +zookeeper.console.threshold=OFF +zookeeper.log.dir=. +zookeeper.log.file=zookeeper.log +zookeeper.log.threshold=DEBUG +zookeeper.tracelog.dir=. +zookeeper.tracelog.file=zookeeper_trace.log + +# +# ZooKeeper Logging Configuration +# + +# Format is " (, )+ + +# DEFAULT: console appender only +log4j.rootLogger=${zookeeper.root.logger} + +# Example with rolling log file +#log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE + +# Example with rolling log file and tracing +#log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE + +# +# Log INFO level and above messages to the console +# +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.Threshold=${zookeeper.console.threshold} +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n + +# +# Add ROLLINGFILE to rootLogger to get log file output +# Log DEBUG level and above messages to a log file +log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender +log4j.appender.ROLLINGFILE.Threshold=${zookeeper.log.threshold} +log4j.appender.ROLLINGFILE.File=${zookeeper.log.dir}/${zookeeper.log.file} + +# Max log file size of 10MB +log4j.appender.ROLLINGFILE.MaxFileSize=10MB +# uncomment the next line to limit number of backup files +#log4j.appender.ROLLINGFILE.MaxBackupIndex=10 + +log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout +log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n + + +# +# Add TRACEFILE to rootLogger to get log file output +# Log DEBUG level and above messages to a log file +log4j.appender.TRACEFILE=org.apache.log4j.FileAppender +log4j.appender.TRACEFILE.Threshold=TRACE +log4j.appender.TRACEFILE.File=${zookeeper.tracelog.dir}/${zookeeper.tracelog.file} + +log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout +### Notice we are including log4j's NDC here (%x) +log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L][%x] - %m%n diff --git a/akka-samples/akka-sample-camel/src/test/resources/logback.xml b/akka-samples/akka-sample-camel/src/test/resources/logback.xml new file mode 100644 index 0000000000..023f2cd317 --- /dev/null +++ b/akka-samples/akka-sample-camel/src/test/resources/logback.xml @@ -0,0 +1,11 @@ + + + + + [%4p] [%d{ISO8601}] [%t] %c{1}: %m%n + + + + + + diff --git a/akka-stm/src/test/scala/transactor/CoordinatedIncrementSpec.scala b/akka-stm/src/test/scala/transactor/CoordinatedIncrementSpec.scala index d05435b98b..c05f41624f 100644 --- a/akka-stm/src/test/scala/transactor/CoordinatedIncrementSpec.scala +++ b/akka-stm/src/test/scala/transactor/CoordinatedIncrementSpec.scala @@ -5,9 +5,10 @@ import org.scalatest.matchers.MustMatchers import org.scalatest.BeforeAndAfterAll import akka.transactor.Coordinated -import akka.actor.{ Actor, ActorRef } +import akka.actor.{ Actor, ActorRef, ActorTimeoutException } import akka.stm.{ Ref, TransactionFactory } import akka.util.duration._ +import akka.event.EventHandler import akka.transactor.CoordinatedTransactionException import akka.testkit._ @@ -80,19 +81,21 @@ class CoordinatedIncrementSpec extends WordSpec with MustMatchers with BeforeAnd } "increment no counters with a failing transaction" in { - filterException[ExpectedFailureException] { - filterException[CoordinatedTransactionException] { - val (counters, failer) = createActors - val coordinated = Coordinated() - counters(0) ! Coordinated(Increment(counters.tail :+ failer)) - coordinated.await - for (counter ← counters) { - (counter ? GetCount).as[Int].get must be === 0 - } - counters foreach (_.stop()) - failer.stop() - } + val ignoreExceptions = Seq( + EventFilter[ExpectedFailureException], + EventFilter[CoordinatedTransactionException], + EventFilter[ActorTimeoutException]) + EventHandler.notify(TestEvent.Mute(ignoreExceptions)) + val (counters, failer) = createActors + val coordinated = Coordinated() + counters(0) ! Coordinated(Increment(counters.tail :+ failer)) + coordinated.await + for (counter ← counters) { + (counter ? GetCount).as[Int].get must be === 0 } + counters foreach (_.stop()) + failer.stop() + EventHandler.notify(TestEvent.UnMute(ignoreExceptions)) } } } diff --git a/akka-stm/src/test/scala/transactor/FickleFriendsSpec.scala b/akka-stm/src/test/scala/transactor/FickleFriendsSpec.scala index 1f79afcdf6..89f8738c10 100644 --- a/akka-stm/src/test/scala/transactor/FickleFriendsSpec.scala +++ b/akka-stm/src/test/scala/transactor/FickleFriendsSpec.scala @@ -5,9 +5,10 @@ import org.scalatest.matchers.MustMatchers import org.scalatest.BeforeAndAfterAll import akka.transactor.Coordinated -import akka.actor.{ Actor, ActorRef } +import akka.actor.{ Actor, ActorRef, ActorTimeoutException } import akka.stm._ import akka.util.duration._ +import akka.event.EventHandler import akka.transactor.CoordinatedTransactionException import akka.testkit._ @@ -110,20 +111,22 @@ class FickleFriendsSpec extends WordSpec with MustMatchers with BeforeAndAfterAl "Coordinated fickle friends" should { "eventually succeed to increment all counters by one" in { - filterException[ExpectedFailureException] { - filterException[CoordinatedTransactionException] { - val (counters, coordinator) = createActors - val latch = new CountDownLatch(1) - coordinator ! FriendlyIncrement(counters, latch) - latch.await // this could take a while - (coordinator ? GetCount).as[Int].get must be === 1 - for (counter ← counters) { - (counter ? GetCount).as[Int].get must be === 1 - } - counters foreach (_.stop()) - coordinator.stop() - } + val ignoreExceptions = Seq( + EventFilter[ExpectedFailureException], + EventFilter[CoordinatedTransactionException], + EventFilter[ActorTimeoutException]) + EventHandler.notify(TestEvent.Mute(ignoreExceptions)) + val (counters, coordinator) = createActors + val latch = new CountDownLatch(1) + coordinator ! FriendlyIncrement(counters, latch) + latch.await // this could take a while + (coordinator ? GetCount).as[Int].get must be === 1 + for (counter ← counters) { + (counter ? GetCount).as[Int].get must be === 1 } + counters foreach (_.stop()) + coordinator.stop() + EventHandler.notify(TestEvent.UnMute(ignoreExceptions)) } } } diff --git a/akka-stm/src/test/scala/transactor/TransactorSpec.scala b/akka-stm/src/test/scala/transactor/TransactorSpec.scala index 2c72fd1650..86d3588814 100644 --- a/akka-stm/src/test/scala/transactor/TransactorSpec.scala +++ b/akka-stm/src/test/scala/transactor/TransactorSpec.scala @@ -4,9 +4,10 @@ import org.scalatest.WordSpec import org.scalatest.matchers.MustMatchers import akka.transactor.Transactor -import akka.actor.{ Actor, ActorRef } +import akka.actor.{ Actor, ActorRef, ActorTimeoutException } import akka.stm._ import akka.util.duration._ +import akka.event.EventHandler import akka.transactor.CoordinatedTransactionException import akka.testkit._ @@ -103,19 +104,21 @@ class TransactorSpec extends WordSpec with MustMatchers { } "increment no counters with a failing transaction" in { - filterException[ExpectedFailureException] { - filterException[CoordinatedTransactionException] { - val (counters, failer) = createTransactors - val failLatch = new CountDownLatch(numCounters + 1) - counters(0) ! Increment(counters.tail :+ failer, failLatch) - failLatch.await(timeout.length, timeout.unit) - for (counter ← counters) { - (counter ? GetCount).as[Int].get must be === 0 - } - counters foreach (_.stop()) - failer.stop() - } + val ignoreExceptions = Seq( + EventFilter[ExpectedFailureException], + EventFilter[CoordinatedTransactionException], + EventFilter[ActorTimeoutException]) + EventHandler.notify(TestEvent.Mute(ignoreExceptions)) + val (counters, failer) = createTransactors + val failLatch = new CountDownLatch(numCounters + 1) + counters(0) ! Increment(counters.tail :+ failer, failLatch) + failLatch.await(timeout.length, timeout.unit) + for (counter ← counters) { + (counter ? GetCount).as[Int].get must be === 0 } + counters foreach (_.stop()) + failer.stop() + EventHandler.notify(TestEvent.UnMute(ignoreExceptions)) } } diff --git a/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala b/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala index 3e8ac34690..0fab0a54b6 100644 --- a/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala @@ -229,6 +229,8 @@ class TestActorRefSpec extends WordSpec with MustMatchers with BeforeAndAfterEac val boss = Actor.actorOf(new Actor { def receive = { case _ ⇒ } }).start() val ref = TestActorRef[WorkerActor].start() + val filter = EventFilter.custom(_ ⇒ true) + EventHandler.notify(TestEvent.Mute(filter)) val log = TestActorRef[Logger] EventHandler.addListener(log) boss link ref @@ -236,6 +238,7 @@ class TestActorRefSpec extends WordSpec with MustMatchers with BeforeAndAfterEac la.count must be(1) la.msg must (include("supervisor") and include("CallingThreadDispatcher")) EventHandler.removeListener(log) + EventHandler.notify(TestEvent.UnMute(filter)) } "proxy apply for the underlying actor" in {