9000
9000

Reputation: 40894

PHP: Sending info to access.log, errors to error.log

I have a legacy app that runs under PHP and Apache.

It does all its logging via error_log(), which ends up in Apache's error.log.

I'd like to only send error messages to error.log, and send other logging to access.log.

What are my options? I would rather not drastically overhaul the Apache's logs format, because other tools parse it.

Am I missing a simpler solution?

Upvotes: 0

Views: 1367

Answers (1)

Alex Howansky
Alex Howansky

Reputation: 53563

access.log is intended to record web server connection activity, and should not be used for application logging. See PSR-3 for a definition of a logger interface. This is implemented by popular packages like Monolog.

Upvotes: 1

Related Questions