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

时间:2022-10-06 09:45:10

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.

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

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.

这是在参与一些RoR开发之后出现的,我错过了rails控制台输出。

1 个解决方案

#1


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

我将看看Pear中的Log类: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.

它非常灵活,可以让你更好地定制东西......肯定会比通过apache的错误日志发送所有内容更好看。如果有的话,代码在包中并不可怕,所以你应该能够根据自己的喜好调整一些东西......我没有遇到像rails console一样漂亮的东西。

#1


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

我将看看Pear中的Log类: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.

它非常灵活,可以让你更好地定制东西......肯定会比通过apache的错误日志发送所有内容更好看。如果有的话,代码在包中并不可怕,所以你应该能够根据自己的喜好调整一些东西......我没有遇到像rails console一样漂亮的东西。