stacktrace.log文件太大 [英] stacktrace.log file is too large

查看:148
本文介绍了stacktrace.log文件太大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目的目标目录中,有一个名为stacktrace.log的文件。我意识到文件的大小已经超过3千兆字节。我删除此文件是否安全?删除它后会导致任何文件没有发现异常?感谢您的时间。



---编辑

如果确实导致文件未找到异常,怎么能我解决了这个问题?

解决方案

stacktrace.log 是默认位置其中Grails编写应用程序抛出的未经过滤的堆栈跟踪异常(对于正常日志记录,它会过滤出内部常规机制的堆栈帧,但有时它可能过于激进,因此可以使用全部跟踪)。您可以安全地删除它,并在下次应用程序启动时将其重新创建。



您可以在 Config.groovy 中的 log4j DSL 中找到 rel =noreferrer code>,在 appenders 块下。默认行为相当于一个appender定义

 文件名:'stacktrace',file:'stacktrace.log` 

在产品模式下和文件:'target / stacktrace.log'在开发模式下,你可以用例如

  rollingFile名称替换它:'stacktrace',file:'stacktrace.log ',
maxFileSize:'5MB',maxBackupIndex:2

将其限制为15MB活动文件加上最多两个滚动备份)。


Inside the target directory of my project, there is a file called stacktrace.log. I have realised size of the file has become more than 3 gigabytes. Is it safe for me to delete this file? Would it cause any file not found exceptions after deleting it? Thanks for your time.

---edit

If it does cause file not found exception, how can I resolve the issue?

解决方案

stacktrace.log is the default location where Grails writes the unfiltered stack traces of exceptions thrown by the app (for normal logging it filters out stack frames that are "internal" groovy mechanics, but sometimes it can be too aggressive so it's handy to have the full traces available). You can safely delete it and it will get recreated empty next time the app starts.

You can control this in the log4j DSL in Config.groovy, under the appenders block. The default behaviour is equivalent to an appender definition of

file name:'stacktrace', file:'stacktrace.log`

in prod mode and file:'target/stacktrace.log' in dev mode, you could replace it with e.g.

rollingFile name:'stacktrace', file:'stacktrace.log',
    maxFileSize:'5MB', maxBackupIndex:2

to limit it to 15MB (the active file plus up to two rolled-over backups).

这篇关于stacktrace.log文件太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆