简体   繁体   English

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

[英]Change Mysql, php and apache2 log file formats

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控制台的输出。

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. 它非常灵活,可以让您更好地自定义内容...当然看起来比通过apache的错误日志发送所有内容更好。 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. 如果有的话,代码在程序包中并不可怕,因此您应该可以根据自己的喜好进行调整...我还没有遇到过像Rails控制台那样出色的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM