Take the 2-minute tour ×

I can't get Akka schedule method to work properly in Heroku. It works fine locally and prints out "Heartbeat" to the log.

Here is the file in question: https://github.com/magnusart/actor-test/blob/master/app/Global.scala and snippet below.

override def onStart(app: Application) {
    Logger.debug("Starting application")
    Akka.system(app).scheduler.schedule(2 seconds, 10 seconds) {

The full application is here (isolated for this purpose, also on actor-test.herokuapp.com). https://github.com/magnusart/actor-test

What does happen after startup is that I see Starting application in the logs and then I don't see anything further after that:

2012-05-26T16:29:40+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=43943 -Xmx384m -Xss512k -XX:+UseCompressedOops`
2012-05-26T16:29:41+00:00 app[web.1]: Play server process ID is 3
2012-05-26T16:29:42+00:00 app[web.1]: [debug] application - Starting application
2012-05-26T16:29:42+00:00 app[web.1]: [info] play - Starting application default Akka system.
2012-05-26T16:29:42+00:00 app[web.1]: [info] play - Application started (Prod)
2012-05-26T16:29:42+00:00 app[web.1]: [info] play - Listening for HTTP on port 43943...

So the scheduled actor doesn't actually seem to start (which it of course does locally). I'm on Heroku Cedar. I grateful for any hints as to why this isn't working, what am I missing?

BR Magnus Andersson

Update From what I've found, this seems to be a bug in Play 2 (I'm running version 2.0.1) and not be related to Heroku. I have updated a Play 2 Lighthouse ticket with relevant information. The ticket can be found here: https://play.lighthouseapp.com/projects/82401-play-20/tickets/448-play-dist-ignores-loggerxml#ticket-448-5

share|improve this question
What exactly isn't working? You mean it's not actually doing the heartbeat at all? This could be due to dyno idling if you are only running on 1 dyno. –  James Ward May 26 '12 at 17:43
I don't know if debug messages are printed on Heroku, since it is supposed to run the app in "production" mode. –  nico_ekito May 26 '12 at 20:31
Hi, sorry for the incomplete information. I have updated my text in the original question now. That include answers to both James, and nico_ekito's questions. I did look at the process with heroku ps and the process hadn't idled out yet (that comes an hour later in the log). Please add a comment if further clarifications are needed. –  Magnus May 26 '12 at 22:20
Actually, nico_ekito might be on to something, that was a good hint. I tried with play stage on my local machine and I don't get any print outs there neither. So there is definitely something going on with play stage that I don't understand. I will investigate a bit more post back here. –  Magnus May 26 '12 at 22:27
It seems like it was the logging. When I put the actor logging to error it actually prints out the "Heardbeat" in the logs. I found this thread: groups.google.com/forum/?fromgroups#!topic/play-framework/…, that seems to talk about the same problem. According to that thread, Play resets the logging during startup. That would explain why I see debug log messages from startup method but not after that. Thank you for your help. Nico_ekito: if you post an answer outlining that I'll accept it, as you hinted what the problem was. –  Magnus May 26 '12 at 23:07
show 2 more comments

1 Answer

up vote 8 down vote accepted

The problem seems to come from your logger setting, because in your Heartbeat you print a message with the "debug" level. AFAIK, Heroku runs your Play app in "production" mode (= "play start"), ie the log level is set to "info" so the debug messages are never printed on Heroku.

share|improve this answer
add comment

Your Answer


