I use akka-http to build a webservice. This works great so far, I just 
don't like the noise of logging. The webservice not only answers to 
websockets requests but also serves *.js and *.css files. The problem is 
that every request creates one of these logging messages:

backend [DEBUG] [08/22/2015 13:23:01.262] 
[default-akka.actor.default-dispatcher-2] 
[akka://default/system/IO-TCP/selectors/$a/0] New connection accepted
...
backend [DEBUG] [08/22/2015 13:23:01.672] 
[default-akka.stream.default-file-io-dispatcher-20] 
[akka://default/user/$a/flow-12-1-concatMatSource-singleSource] No more 
bytes available to read (got `-1` or `0` from `read`), marking final bytes 
of file @ -1
...
backend [DEBUG] [08/22/2015 13:23:06.677] 
[default-akka.actor.default-dispatcher-10] 
[akka://default/user/$a/flow-10-3-publisherSource-prefixAndTail] Cancelling 
akka.stream.impl.MultiStreamOutputProcessor$SubstreamOutput@48be1c2d 
(after: 5000 ms)

It tells me that the connection is accepted and because no further requests 
arrive it closes the connection after 5s. And it even tells me that no more 
bytes are available. All of these messages are unnecessary. Can I disable 
them somehow?

I created the server with this:

  val binding = Http().bindAndHandle(service.route, interface, port)

where route looks like this:

  def route = get {
    pathSingleSlash(complete {
      val content = Content.indexPage(
        cssDeps = Seq("default.css", "codemirror.css", "solarized.css"),
        jsDeps = Seq("clike.js", "markdown.js", 
"scalajs-test-ui-fastopt.js", "scalajs-test-ui-launcher.js")
      )
      HttpEntity(MediaTypes.`text/html`, content)
    }) ~
    
path("scalajs-test-ui-jsdeps.js")(getFromResource("scalajs-test-ui-jsdeps.js")) 
~
    
path("scalajs-test-ui-fastopt.js")(getFromResource("scalajs-test-ui-fastopt.js"))
 
~
    
path("scalajs-test-ui-launcher.js")(getFromResource("scalajs-test-ui-launcher.js"))
 
~
    path("marked.js")(getFromResource("marked/lib/marked.js")) ~
    path("clike.js")(getFromResource("codemirror/mode/clike/clike.js")) ~
    
path("markdown.js")(getFromResource("codemirror/mode/markdown/markdown.js")) 
~
    path("default.css")(getFromResource("default.css")) ~
    
path("codemirror.css")(getFromResource("codemirror/lib/codemirror.css")) ~
    
path("solarized.css")(getFromResource("codemirror/theme/solarized.css")) ~
    path("auth") {
      handleWebsocketMessages(authClientFlow())
    } ~
    path("communication") {
      parameter('name) { name ⇒
        handleWebsocketMessages(communicationFlow(sender = name))
      }
    } ~
    rejectEmptyResponse {
      path("favicon.ico")(getFromResource("favicon.ico", 
MediaTypes.`image/x-icon`))
    }
  }

Maybe I need to split things up and handle websockets by a different 
routing?

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to