I have logging configured going to console and a log file. In heroku world, does it even make sense to log to a file? Is there any way I can retrive the log file?
3 Answers
To access the logging stream, you simply heroku logs
and you'll see the full stream. Anything you output with your applications logger will go here.
You do not have log files.
Should you wish to capture files to frame and put on your wall, sign up for a service such as Papertrail and use the syslog drains to get your Heroku logs into there. From there they can dump to S3.

- 22,105
- 18
- 80
- 134
To get the logs, just type in heroku logs
or heroku logs -n X
in your shell.
Where X
can be any number up to 1500
, denoting the number of lines you want to fetch. If you want to archive your log, you need to use a syslog drain, as is outlined here.

- 32,662
- 13
- 66
- 111
-
a good answer but not what I asked. I know how to get logs by doing `heroku logs'. What I asked is log files not stdout logs. – Bobo Feb 10 '12 at 20:02
-
I (more specifically) address your question in the second part of my answer. To get a log "file" (or archive), you need to use the syslog drain. Heroku doesn't save log files. – David Titarenco Feb 10 '12 at 20:25
-
3Drains are free. heroku drains:add
– Neil Middleton Feb 11 '12 at 00:06
Use this shell command to save your logs locally using heroku cli:
heroku logs -n number_of_lines --app application_name >> file_name.txt
>>
will append the command output to the file and saves it: file_name.txt
number_of_lines
is limited to a maximum of 1500 by heroku.
Sample command:
heroku logs -n 500 --app sample_app >> logs.txt
Thanks to the Anuja Joshi's answer

- 1
- 1

- 75
- 1
- 12