0

I need to have a custom Logger that logs specific actions that occur in my deployed application in Heroku. This log is for the user to view (that's why the default logger is no good here).

While testing on development on local everything is fine. I have

logger = Logger.new(PATH)
logger.info("...")

PATH is set on environment variables.

Now I want to deploy to Heroku but I find myself with a problem: how can the user view this log? Where would I need to save it?

Vasfed
  • 18,013
  • 10
  • 47
  • 53
fedest
  • 1,190
  • 3
  • 15
  • 35

2 Answers2

1

On heroku filesystem is read-only, you should log to stdout. Default log can be directed there by rails_12factor gem (or configure by youself, but the former is easier)

But for custom log, that is going to be viewed by the user it's better to write to db, because probability of future access control being needed is high

Vasfed
  • 18,013
  • 10
  • 47
  • 53
  • This was really useful, and I'll mark this question as correct since this one gives me an option on what to do. – fedest Jun 30 '16 at 15:27
0

Heroku has an ephemeral filesystem meaning whatever file you upload would be deleted shortly afterwards. If you need a custom logger on Heroku, I'd say you should probably use something that is more persistent. You may use something like Redis.

Look at this answer for more info.

Community
  • 1
  • 1
oreoluwa
  • 5,553
  • 2
  • 20
  • 27