1

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?

user645402
  • 737
  • 1
  • 16
  • 34

1 Answers1

0

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.

Sven
  • 69,403
  • 10
  • 107
  • 109