dongnaizao8039 2009-07-29 23:36
浏览 26
已采纳

PHP错误日志和换行符

What's the PHP config setting which allows or prevents newlines in debug output from being escaped?

On two different installs (a dev laptop running MAMP/OSX, and a dev server running debian) I see different results in the error logs when debugging.

error_log(print_r(array(1,2,4),1));

On Debian this appears in /var/log/apache2/error.log as

[Thu Jul 30 11:32:34 2009] [error] [client 118.93.246.104] Array
(
    [0] => 1
    [1] => 2
    [2] => 4
)
, referer: http://dev.example.org/

On OSX this appears in /Applications/MAMP/logs/php_error_log as

[30-Jul-2009 11:34:00] Array
(
    [0] => 1
    [1] => 2
    [2] => 4
)

I prefer the MAMP way for debugging (apart from relocating logfiles to the /Applications directory).

Thanks!

  • 写回答

3条回答 默认 最新

  • dongsanhu4784 2009-07-30 00:43
    关注

    Chris, you should be able to change the error_log directive in your php.ini on Debian to point to a file. If this is undefined, it will go through syslog which doesn't support multiple lines.

    Details:

    error_log function

    error_log directive

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了