3

Working on an app using Akka 2 deployed with Play-mini. I pulled logback into the project and it works, but its config gets stomped so it was necessary to do a Joran configuration method and have that called at startup. Then I read that play had moved to logback so I rummaged around to see how to use the logger that's built into Play and figured it out, but as soon as I type:

Logger.debug(

it only supports:

debug(String message, Throwable error)
debug(String message)

The whole point of logback is the variable argument stuff so you don't have to dirty up your code with:

if (Logger.isDebugEnabled()){
     Logger.debug("my expensive message: " + largeObject.toString());
}

So I must be missing something. Docs are not great in this area either.

BTW, here is a thread about the config getting mussed.

Matt Ball
  • 354,903
  • 100
  • 647
  • 710
Rob
  • 11,446
  • 7
  • 39
  • 57
  • Perhaps look into using Akka's logging? http://doc.akka.io/docs/akka/2.0.1/scala/logging.html – Viktor Klang May 01 '12 at 20:22
  • Yeah I saw that Viktor. I guess I am still a tad confused about whether Akka or play-mini is in charge of the runtime config. Will try and see if this gets me past this. This will support the logback var arg syntax, no? [Thanks!] – Rob May 01 '12 at 20:51
  • I read them a lot, Viktor. (More than I would have had to were they better…) – Rob May 01 '12 at 23:58
  • Please send in feedback on the docs as to how we can improve them, it's nigh impossible to improve without feedback. – Viktor Klang May 02 '12 at 09:18
  • I will, Viktor. As you saw, I am 90% positive on Akka so far. Just a lot of minor things that mar the experience of getting going. My biggest suggestion is better examples. Thanks! – Rob May 02 '12 at 16:11
  • Thanks, I'll open a ticket about that. – Viktor Klang May 02 '12 at 18:45
  • Drop me a link. I'd be happy to do one or two. For instance, would like to see a hello world where the app goes out (asynchronously) to a translation web service and translates the words into another language then puts them back together again. – Rob May 03 '12 at 04:05
  • I still have not been able to figure out how I can take a REST call in which I send a message to an Actor, that then gets other Actors to divide up work, then pulls the results back together again and returns them. I was able to do this with composable Futures and a single Await call, but if I send a message to an Actor, then drop into an Await with an ask inside, isn't the Actor just going to return nothing? There's no ask example. – Rob May 03 '12 at 04:07
  • Have you've asked on the Play! user mailing list? – Viktor Klang May 03 '12 at 19:05
  • No because I am using Akka/Play-mini. Should I? I thought this was pretty much an Akka question. I am probably going to get a subscription (Typesafe). – Rob May 03 '12 at 20:35
  • Did you see http://doc.akka.io/docs/akka/2.0.1/scala/actors.html#Ask__Send-And-Receive-Future ? For more info on how to get the subscription, please have a look here: http://typesafe.com/products/typesafe-subscription – Viktor Klang May 03 '12 at 21:06

1 Answers1

1

Yes, Play is hard coded to use LogBack, and unless you specify, it takes over your log settings. Very annoying.

Stop Play from butchering logback settings : https://github.com/typesafehub/play2-mini/issues/7

Antony Stubbs
  • 13,161
  • 5
  • 35
  • 39