Is there an event or hook for errors?

Nextcloud maintains “nexcloud.log” when errors etc. occur. I’d like to catch each write or error situation in an app. Is there an event or hook for errors?

No. There is no event or hook.

How about a listener for checking if nextcloud.log file has been changed?

There is no event emitted when the logfile is changed. I guess professional setup’s feed nextcloud.log (file or syslog) to log monitoring systems and implement notifications for critical errors there.

In theory you may write your own logger implementation and decorate the internal logger. But any error that occurs before your “logging app” is loaded is not forwarded to your logger because it’s not registered.

I was under the impression that “nextcloud.log” is maintained completely by Nexcloud. Is apache and php feeding nextcloud also?

nextcloud.log is maintained by nextcloud. php errors are forwarded to nextcloud.log too (because nextcloud registers an error handler). apache should not write anything into nextcloud.log.