1

In PHP, I am using this code to define where to log errors:

ini_set('error_log', dirname(__FILE__) . '/err_logs/error_log.txt');

On a normal server it works great, but I am using Heroku and apparently when the virtual machine is terminated and then restarted, I lose the error log text file!

Can I store the error log text file onto a remote location?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mark Belli
  • 740
  • 1
  • 9
  • 17
  • Of course, email it, ftp it, http post it, cron script to move it, dropbox it. How would you like to do it? – shapeshifter Dec 04 '12 at 01:18
  • Check out this answer I wrote a few days ago http://stackoverflow.com/questions/13563078/how-do-i-set-up-php-logging-to-go-to-a-remote-server/13564632#13564632 – Michel Feldheim Dec 04 '12 at 01:21
  • Michel: thanks for the input but then I would need a server always listening.. a ftp transfer would be enough for me! – Mark Belli Dec 04 '12 at 01:26
  • shapeshifter: how about this: if the log exist then copy it to ftp.. ps: how would I prevent overwriting? copying to a folder with a different timestamp? – Mark Belli Dec 04 '12 at 01:27

1 Answers1

1

Create a cron job that emails you the log every day. Or, you can move it using SSH, FTP, or a web service.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ian Atkin
  • 6,302
  • 2
  • 17
  • 24
  • 1
    I created a cron that emails the logfile every 30 minutes and then deletes the file. FTP_PUT command is not available in heroku due to the dyno isolation... so had to find another solution! Thanks – Mark Belli Dec 04 '12 at 15:37