Rails Production.log 是否无限期存储?
如果不是,它的半衰期是多少?
确实如此,哪里可以找到该信息?
在我的服务器上,我发现了每个版本的一些日志。但它们只能追溯到几天前。
具体来说,我正在查找两周前我的邮件服务器停机时发送的电子邮件。
If it doesn't, what's the half-life of it?
It it does, where can find that information?
On my server I found a few logs for each of my releases. But they only date back a few days.
Specifically, I am looking for emails that were sent while my mail server was down two weeks ago.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简短回答:是的,它会无限期存储。如果您找不到所需的信息,则您可能在不知不觉中截断了日志,或者您的应用程序进行了其他配置。
稍微长一点的答案:默认记录器是
ActiveSupport::BufferedLogger
的一个实例,它是一个非常简单的记录器。甚至比 Ruby 的普通 Logger 类还要简单。它不知道限制或旋转。但 Rails 与任何 Ruby Logger 或类似 Log4r 的对象兼容。如果您安装的应用程序不是您自己制作的,并且您想知道它是否执行与普通 Rails 不同的操作,您可以查看您的 config 目录以查看它是否使用不同的记录器类。
通常使用
config/environment.rb
或config/environments/Production.rb
中的config.logger = [...]
配置不同的记录器>。在默认的 Rails 应用程序模板中,后一个文件包含以下带注释的示例:Short answer: Yes, it stores indefinitely. If you cannot find the information you are looking for, you may have unknowingly truncated the log at some point, or your application is configured otherwise.
Slightly longer answer: The default logger is an instance of
ActiveSupport::BufferedLogger
, which is a really simple logger. Even simpler than Ruby's stock Logger class. It doesn't know about limits or rotation.But Rails is compatible with any Ruby Logger or Log4r-like object. If the application you installed is not one of your own making, and you want to know if it's doing something different from stock Rails, you could look in your
config
directory to see if it's using a different logger class.A different logger is usually configured using
config.logger = [...]
inconfig/environment.rb
orconfig/environments/production.rb
. In the default Rails application template, the latter file contains the following commented example:我使用:
在 config/environments/production.rb 中。并根据
API
有 1000 条日志消息限制。
I use:
in config/environments/production.rb. And according to
the apis
there is a 1000 log message limit.