如何避免在日志文件中写入 php 通知和警告? [英] How to avoid writing php notices and warnings in log files?

查看:40
本文介绍了如何避免在日志文件中写入 php 通知和警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法避免在 php 日志文件中写入通知和警告?我想写致命错误和解析错误,但我想避免写通知和警告,因为日志越来越大.

Is there anyway to avoid writing notices and warnings in php log files? I want fatal error and parse errors to be written, but I want to avoid writing notices and warnings since the size of the logs grow larger.

推荐答案

避免它们被写入的最简单方法是简单地检查当前记录的警告和通知,并简单地修复问题.如果您担心日志大小因这些警告和通知而变得过大,则它们必须非常频繁地被记录,在这种情况下忽略它们可能不是一个好主意.

The easiest way to avoid them from being written is to simply check the warnings and notices that are currently logged and to simply fix the issues. If you're concerned that the log size is getting too large as a result of these warnings and notices, they must be getting logged very frequently in which case ignoring them probably isn't a good idea.

毕竟,这就是日志的用途.因此,您的代码会变得更好,而且您将不再埋头苦干而忽略项目中仍然存在的问题.

After all, that's what the logs are for. Your code will be better as a result, and you'll no longer be sticking your head in the sand and ignoring what is still an issue in your project.

这篇关于如何避免在日志文件中写入 php 通知和警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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