更改 Mysql、php 和 apache2 日志文件格式

发布于 2024-07-27 19:34:23 字数 1210 浏览 8 评论 0原文

我正在将 php 错误、所有 mysql 查询、apache2 错误和 mod_rewrite 调试发送到一个文件,不用说那里很忙。

格式可以从: 更改

[22-Jul-2009 23:00:58] Parameters: 
GET Array
(
)

POST Array
(
)
    [22-Jul-2009 23:00:58] Finding Associations
                237 Query       SELECT `table`.* FROM `table` WHERE 1=1 ORDER BY date ASC
                237 Query       SELECT `table2`.* FROM `table2` WHERE RAND()  ORDER BY id
                237 Quit       
    [Wed Jul 22 23:00:58 2009] [error] [client 127.0.0.1] script '/var/www/default/public/static/js/menu.js' not found or unable to stat, referer: http://localhost
    [Wed Jul 22 23:00:58 2009] [error] [client 127.0.0.1] script '/var/www/default/public/404.php' not found or unable to stat, referer: http://localhost
    090722 23:03:00     238 Connect     development@localhost on project
                238 Query       SELECT @@sql_mode
                238 Query       SET SESSION sql_mode=''
                238 Query       SET NAMES utf8
                238 Query       SELECT @@SQL_MODE
                238 Query       SHOW FULL COLUMNS FROM `table`.`users`

为具有较少选项卡等的格式吗?我正在跟踪日志文件,并且理想情况下也希望稍后添加一些颜色。

这是在参与一些 RoR 开发后发生的,并且我缺少 Rails 控制台输出。

I am sending php errors, all mysql queries, apache2 errors and mod_rewrite debugging to one file, needless to say it's busy in there.

Can the format be changed from:

[22-Jul-2009 23:00:58] Parameters: 
GET Array
(
)

POST Array
(
)
    [22-Jul-2009 23:00:58] Finding Associations
                237 Query       SELECT `table`.* FROM `table` WHERE 1=1 ORDER BY date ASC
                237 Query       SELECT `table2`.* FROM `table2` WHERE RAND()  ORDER BY id
                237 Quit       
    [Wed Jul 22 23:00:58 2009] [error] [client 127.0.0.1] script '/var/www/default/public/static/js/menu.js' not found or unable to stat, referer: http://localhost
    [Wed Jul 22 23:00:58 2009] [error] [client 127.0.0.1] script '/var/www/default/public/404.php' not found or unable to stat, referer: http://localhost
    090722 23:03:00     238 Connect     development@localhost on project
                238 Query       SELECT @@sql_mode
                238 Query       SET SESSION sql_mode=''
                238 Query       SET NAMES utf8
                238 Query       SELECT @@SQL_MODE
                238 Query       SHOW FULL COLUMNS FROM `table`.`users`

to something with less tabbing etc, i'm tailing the log file and would ideally like to add some colour later on aswell.

This has come about after getting involved in some RoR development and i'm missing the rails console output.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

慈悲佛祖 2024-08-03 19:34:24

我会看一下 Pear 中的 Log 类: http://pear.php.net/package /log/

它非常灵活,可以让你更好地定制一些东西......当然会比通过 apache 的错误日志发送所有内容看起来更好。 如果有的话,包中的代码并不糟糕,所以你应该能够根据自己的喜好进行调整......我还没有遇到过像 Rails 控制台那样漂亮的东西。

I would take a look at the Log class in Pear: http://pear.php.net/package/log/

It's pretty flexible and may allow you to customize things a bit better... certainly will look nicer than sending everything through something apache's error log. If anything, the code isn't terrible in the package, so you should be able to tweak things to your liking... I haven't come across anything as spiffy as the rails console tho.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文