douweng7308 2013-06-14 20:49
浏览 37

记录到error_log()的log4php appender

How can you log to web server's log ( error_log() ) using log4php? I think what this ultimately means is to have a log appender that logs to error_log(). Seems like a no brainer, but I couldn't find anything in the log4php documentation and I couldn't find anything online about someone already doing this... Is this something that's easy to do and I'm just missing it?

  • 写回答

1条回答 默认 最新

  • dongzhe3171 2013-06-18 22:55
    关注

    I haven't found such an appender either. Seems like there is no such thing. You'd probably be best of if you are using the FileAppender and give it the name of the error_log ini setting if that is a filename.

    If the error_log directive is set to syslog, there is a SyslogAppender.

    Note however that the error_log() function itself has a target parameter that most of the time is identical to what dedicated appenders already provide. With the added uncertainty of where the error messages really end up depending on configuration, I feel it's a better idea to leave it up to the Log4PHP configuration. Sending mail, logging to a file, logging to syslog: All already supported. The only case missing: Logging to the SAPI logging handler.

    评论

报告相同问题?

悬赏问题

  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害