Search code examples
akkaakka-streamakka-http

Disabling error logging in akka http


Making requests to third party services beyond my control, I've encountered the following exception in the logs:

2017-10-25 17:08:45 [main-actor-system-akka.actor.default-dispatcher-16] ERROR akka.actor.RepointableActorRef - Error in stage [akka.http.impl.engine.client.OutgoingConnectionBlueprint$PrepareResponse@7feef72e]: Illegal response status code: 920
akka.http.scaladsl.model.IllegalResponseException: Illegal response status code: 920
at akka.http.impl.engine.client.OutgoingConnectionBlueprint$PrepareResponse$$anon$1.onPush(OutgoingConnectionBlueprint.scala:191)
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:499)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:401)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:571)
at akka.stream.impl.fusing.ActorGraphInterpreter$SimpleBoundaryEvent.execute(ActorGraphInterpreter.scala:42)
at akka.stream.impl.fusing.ActorGraphInterpreter$SimpleBoundaryEvent.execute$(ActorGraphInterpreter.scala:38)
at akka.stream.impl.fusing.ActorGraphInterpreter$BatchingActorInputBoundary$OnNext.execute(ActorGraphInterpreter.scala:75)
at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:546)
at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:725)
at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:740)
at akka.actor.Actor.aroundReceive(Actor.scala:514)
at akka.actor.Actor.aroundReceive$(Actor.scala:512)
at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:650)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:527)
at akka.actor.ActorCell.invoke(ActorCell.scala:496)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
at akka.dispatch.Mailbox.run(Mailbox.scala:224)
at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

I'm using a superPool in a Flow:

Flow[String].map(x => Get(x) -> NotUsed) // simplified: url as string
  .via(Http().superPool[NotUsed]())
  .map {
    // handle response: Success and Failure. It resumes on failure.
  }
  ...

Note that it doesn't crash the graph, I would just like to get rid of the log messages.

I don't log it anywhere myself.

Here is my application.conf:

akka {
  http {
    parsing {
      uri-parsing-mode = relaxed
      cookie-parsing-mode = raw
      illegal-header-warnings = off
      illegal-response-header-value-processing-mode = ignore
      error-logging-verbosity = off
    }
  }
}

using akka 2.5.4, akka-http 10.0.10


Solution

  • I think the best way to work around this is to actually register the invalid status codes returned by the server, there is a page in the docs describing how you do that with a sample here: https://doc.akka.io/docs/akka-http/10.0.10/scala/http/common/http-model.html#registering-custom-status-codes