开发者

Output Rails production log to RSS feed, third-party web app, etc.?

开发者 https://www.devze.com 2023-04-03 18:21 出处:网络
Is there an existing web application somewhere or an easy way to build one that re-serves the production log as an RSS feed or simple web开发者_如何学编程 page, etc.? (RoR 3.0.5) We\'d like other peop

Is there an existing web application somewhere or an easy way to build one that re-serves the production log as an RSS feed or simple web开发者_如何学编程 page, etc.? (RoR 3.0.5) We'd like other people to be able to glance at the log like the would other content they're used to… Any help is appreciated. Thanks!


First & foremost: Keep in mind the production log file contains sensitive data. Serving it as a web page or rss feed, even when password-protected, is very rarely wise.

With that said, it wouldn't be difficult to do.

  # Security suicide
  def get_production_log
    File.open(File.join(Rails.root, 'log', 'production.log')) do |log|
      content = ''
      while (line = log.gets)
        content << line + "<br />"
      end
    end
    content
  end

To quote the apothecary from romeo & juliet: My poverty of StackOverflow points, but not my will, consents

0

精彩评论

暂无评论...
验证码 换一张
取 消