Nextcloud responds with 500 and occ fails with 'Could not resolve logger'

Support intro

I run an older version of Nextcloud (nc 20.0.14) due to some limits of the hosting. All of a sudden - I expect some server reload - Nextcloud only responded with an internal server error (500).

I tried to find the reason and fix them using occ, but occ itself does not work anymore, only showing some stack trace. I would be very thankful if someone can provide me a solution, or point me into the right direction.

Nextcloud version (eg, 20.0.5): 20.0.14
Operating system and version (eg, Ubuntu 20.04): CentOS 7.9
Apache or nginx version (eg, Apache 2.4.25): nginx
PHP version (eg, 7.4): 7.4

The issue you are facing:

Nextcloud all of a sudden starts to fail with an internal server error. I suppose the hoster did some service reload / restart. I tried to get some status information on Nextcloud, but occ also failed (please see output below) with a stack trace.
As nothing has been updated before, there may be some internal update process for certain parts, or this is a problem caused by the previous upgrade that now came up due to some realod.

Upgrading to a newer version seems also not possible as occ does not work.

Unfortunately I am not enough into Nextcloud and PHP to find the reason for this error by myself. So hopefully someone from the community can help me, or at least point me into the right direction.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

Could not replicate it on a testing system. Seems to be very rare as I could not find some good information on the Internet.

Output of php occ status

An unhandled exception has been thrown:
OCP\AppFramework\QueryException: Could not resolve logger! Class logger does not exist in [...]/lib/private/AppFramework/Utility/SimpleContainer.php:115
Stack trace:
#0 [...]/lib/private/AppFramework/Utility/SimpleContainer.php(126): OC\AppFramework\Utility\SimpleContainer->resolve('logger')
#1 [...]/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query('logger', true)
#2 [...]/lib/private/AppFramework/Utility/SimpleContainer.php(96): OC\ServerContainer->query('logger')
#3 [internal function]: OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(ReflectionParameter))
#4 [...]/lib/private/AppFramework/Utility/SimpleContainer.php(101): array_map(Object(Closure), Array)
#5 [...]/lib/private/AppFramework/Utility/SimpleContainer.php(109): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#6 [...]/lib/private/AppFramework/Utility/SimpleContainer.php(126): OC\AppFramework\Utility\SimpleContainer->resolve('OC\\TempManager')
#7 [...]/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query('OC\\TempManager', true)
#8 [...]/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query('OC\\TempManager')
#9 [...]/lib/private/AppFramework/Utility/SimpleContainer.php(177): OC\AppFramework\Utility\SimpleContainer->get('OC\\TempManager')
#10 [...]/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#11 [...]/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#12 [...]/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet('OCP\\ITempManage...')
#13 [...]/lib/private/ServerContainer.php(156): OC\AppFramework\Utility\SimpleContainer->query('OCP\\ITempManage...', true)
#14 [...]/lib/private/Server.php(1887): OC\ServerContainer->query('OCP\\ITempManage...')
#15 [...]/lib/base.php(740): OC\Server->getTempManager()
#16 [...]/lib/base.php(1091): OC::init()
#17 [...]/console.php(49): require_once('/var/www/virtua...')
#18 [...]/occ(11): require_once('/var/www/virtua...')

Thanks in advance for any kind of help here.

I have the same problem since yesterday. I have Nextcloud version 20.0.11 installed on CentOS 7 (php 7.4).

Class logger does not exist in [...deleted...]/lib/private/AppFramework/Utility/SimpleContainer.php:115

Any ideas? Thanks in advance :slight_smile:

Same story here: Yesterday my Nextcloud 20.0.11.1 (CentOS 7, PHP 7.4.27) stopped working as well, occ throws the exact same error message.
nextcloud.log contains only exceptions after these lines:

{"reqId":"BGmmS9r1xuy4J1fPESro","level":1,"time":"2022-01-20T11:45:03+00:00","remoteAddr":"","user":"--","app":"cli","method":"","url":"--","message":"Memcache \\OC\\Memcache\\APCu not available for local cache","userAgent":"--","version":"20.0.11.1"}
{"reqId":"BGmmS9r1xuy4J1fPESro","level":1,"time":"2022-01-20T11:45:03+00:00","remoteAddr":"","user":"--","app":"cli","method":"","url":"--","message":"Memcache \\OC\\Memcache\\APCu not available for distributed cache","userAgent":"--","version":"20.0.11.1"}
{"reqId":"BGmmS9r1xuy4J1fPESro","level":3,"time":"2022-01-20T11:45:03+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":{"Exception":"OCP\\AppFramework\\QueryException","Message":"Could not resolve logger! Class logger does not exist","Code":0,"Trace":[{"file":"/var/www/virtual/*replaced*/html/lib/private/AppFramework/Utility/SimpleContainer.php","line":126,"function":"resolve","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["logger"]},{"file":"/var/www/virtual/*replaced*/html/lib/private/ServerContainer.php","line":156,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["logger",true]},{"file":"/var/www/virtual/*replaced*/html/lib/private/AppFramework/Utility/SimpleContainer.php","line":96,"function":"query","class":"OC\\ServerContainer","type":"->","args":["logger"]},{"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/virtual/*replaced*/html/lib/private/AppFramework/Utility/SimpleContainer.php","line":101,"function":"array_map","args":[{"__class__":"Closure"},[{"name":"config","__class__":"ReflectionParameter"},{"name":"container","__class__":"ReflectionParameter"},{"name":"userManager","__class__":"ReflectionParameter"},{"name":"groupManager","__class__":"ReflectionParameter"},"*** sensitive parameter replaced ***",{"name":"notificationManager","__class__":"ReflectionParameter"}]]},{"file":"/var/www/virtual/*replaced*/html/lib/private/AppFramework/Utility/SimpleContainer.php","line":109,"function":"buildClass","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":[{"name":"OC\\Support\\Subscription\\Registry","__class__":"ReflectionClass"}]},{"file":"/var/www/virtual/*replaced*/html/lib/private/AppFramework/Utility/SimpleContainer.php","line":126,"function":"resolve","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OC\\Support\\Subscription\\Registry"]},{"file":"/var/www/virtual/*replaced*/html/lib/private/ServerContainer.php","line":156,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OC\\Support\\Subscription\\Registry",true]},{"file":"/var/www/virtual/*replaced*/html/lib/private/AppFramework/Utility/SimpleContainer.php","line":56,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OC\\Support\\Subscription\\Registry"]},{"file":"/var/www/virtual/*replaced*/html/lib/private/AppFramework/Utility/SimpleContainer.php","line":177,"function":"get","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OC\\Support\\Subscription\\Registry"]},{"file":"/var/www/virtual/*replaced*/html/lib/private/AppFramework/Utility/SimpleContainer.php","line":155,"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/virtual/*replaced*/html/3rdparty/pimple/pimple/src/Pimple/Container.php","line":114,"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/virtual/*replaced*/html/lib/private/AppFramework/Utility/SimpleContainer.php","line":122,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OCP\\Support\\Subscription\\IRegistry"]},{"file":"/var/www/virtual/*replaced*/html/lib/private/ServerContainer.php","line":156,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OCP\\Support\\Subscription\\IRegistry",true]},{"file":"/var/www/virtual/*replaced*/html/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":430,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OCP\\Support\\Subscription\\IRegistry",true]},{"file":"/var/www/virtual/*replaced*/html/apps/support/lib/AppInfo/Application.php","line":53,"function":"query","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->","args":["OCP\\Support\\Subscription\\IRegistry"]},{"file":"/var/www/virtual/*replaced*/html/lib/private/AppFramework/Bootstrap/Coordinator.php","line":170,"function":"boot","class":"OCA\\Support\\AppInfo\\Application","type":"->","args":[{"__class__":"OC\\AppFramework\\Bootstrap\\BootContext"}]},{"file":"/var/www/virtual/*replaced*/html/lib/private/legacy/OC_App.php","line":199,"function":"bootApp","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->","args":["support"]},{"file":"/var/www/virtual/*replaced*/html/lib/private/legacy/OC_App.php","line":132,"function":"loadApp","class":"OC_App","type":"::","args":["support"]},{"file":"/var/www/virtual/*replaced*/html/lib/base.php","line":647,"function":"loadApps","class":"OC_App","type":"::","args":[["session"]]},{"file":"/var/www/virtual/*replaced*/html/lib/base.php","line":1091,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/virtual/*replaced*/html/cron.php","line":42,"args":["/var/www/virtual/*replaced*/html/lib/base.php"],"function":"require_once"}],"File":"/var/www/virtual/*replaced*/html/lib/private/AppFramework/Utility/SimpleContainer.php","Line":115,"CustomMessage":"Could not boot supportCould not resolve logger! Class logger does not exist"},"userAgent":"--","version":"20.0.11.1"}

three cases on the same date, the same distro, same php?
Starts to look like a pattern…
Are you perhaps also running Nextcloud on uberspace?

Edit:
Trying to configure APCu correctly did not resolve the issue.

Edit 2:
I took a closer look at the logfiles. A Day before the crash the nexcloud.log reached it’s size limit and was rotated. the new logfile then started to contain more and more error traces, which the rotated old one does not contain at all:

{"reqId":"h7F828lUP24bSW69CzU0","level":2,"time":"2022-01-19T07:15:17+00:00","remoteAddr":"","user":"--","app":"OC\\Log\\Rotate","method":"","url":"--","message":"Log file \"/var/www/virtual/*replaced*/nextcloud_data/nextcloud.log\" was over 104857600 bytes, moved to \"/var/www/virtual/*replaced*/nextcloud_data/nextcloud.log.1\"","userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":0,"time":"2022-01-19T07:15:17+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OC\\Log\\Rotate job with ID 25 in 0 seconds","userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":0,"time":"2022-01-19T07:15:18+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\Talk\\BackgroundJob\\ExpireSignalingMessage job with ID 28","userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":0,"time":"2022-01-19T07:15:19+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\Talk\\BackgroundJob\\ExpireSignalingMessage job with ID 28 in 1 seconds","userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":0,"time":"2022-01-19T07:15:19+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\Talk\\BackgroundJob\\ResetAssignedSignalingServer job with ID 30","userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":0,"time":"2022-01-19T07:15:19+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\Talk\\BackgroundJob\\ResetAssignedSignalingServer job with ID 30 in 0 seconds","userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":0,"time":"2022-01-19T07:15:20+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\DocumentServer\\BackgroundJob\\Cleanup job with ID 33","userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":3,"time":"2022-01-19T07:15:20+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":{"Exception":"Error","Message":"Use of undefined constant EXPIRED_SESSION_TIMEOUT - assumed 'EXPIRED_SESSION_TIMEOUT' (this will throw an Error in a future version of PHP) at /var/www/virtual/*replaced*/html/apps/documentserver_community/lib/Channel/SessionManager.php#134","Code":0,"Trace":[{"file":"/var/www/virtual/*replaced*/html/apps/documentserver_community/lib/Channel/SessionManager.php","line":134,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"Use of undefined constant EXPIRED_SESSION_TIMEOUT - assumed 'EXPIRED_SESSION_TIMEOUT' (this will throw an Error in a future version of PHP)","/var/www/virtual/*replaced*/html/apps/documentserver_community/lib/Channel/SessionManager.php",134,{"query":{"__class__":"OC\\DB\\QueryBuilder\\QueryBuilder"}}]},{"file":"/var/www/virtual/*replaced*/html/apps/documentserver_community/lib/Channel/SessionManager.php","line":143,"function":"getExpiredSessions","class":"OCA\\DocumentServer\\Channel\\SessionManager","type":"->","args":[]},{"file":"/var/www/virtual/*replaced*/html/apps/documentserver_community/lib/BackgroundJob/Cleanup.php","line":65,"function":"cleanSessions","class":"OCA\\DocumentServer\\Channel\\SessionManager","type":"->","args":[]},{"file":"/var/www/virtual/*replaced*/html/lib/public/BackgroundJob/Job.php","line":80,"function":"run","class":"OCA\\DocumentServer\\BackgroundJob\\Cleanup","type":"->","args":[null]},{"file":"/var/www/virtual/*replaced*/html/cron.php","line":127,"function":"execute","class":"OCP\\BackgroundJob\\Job","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]}],"File":"/var/www/virtual/*replaced*/html/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":3,"time":"2022-01-19T07:15:20+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":{"Exception":"Error","Message":"A non-numeric value encountered at /var/www/virtual/*replaced*/html/apps/documentserver_community/lib/Channel/SessionManager.php#134","Code":0,"Trace":[{"file":"/var/www/virtual/*replaced*/html/apps/documentserver_community/lib/Channel/SessionManager.php","line":134,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[2,"A non-numeric value encountered","/var/www/virtual/*replaced*/html/apps/documentserver_community/lib/Channel/SessionManager.php",134,{"query":{"__class__":"OC\\DB\\QueryBuilder\\QueryBuilder"}}]},{"file":"/var/www/virtual/*replaced*/html/apps/documentserver_community/lib/Channel/SessionManager.php","line":143,"function":"getExpiredSessions","class":"OCA\\DocumentServer\\Channel\\SessionManager","type":"->","args":[]},{"file":"/var/www/virtual/*replaced*/html/apps/documentserver_community/lib/BackgroundJob/Cleanup.php","line":65,"function":"cleanSessions","class":"OCA\\DocumentServer\\Channel\\SessionManager","type":"->","args":[]},{"file":"/var/www/virtual/*replaced*/html/lib/public/BackgroundJob/Job.php","line":80,"function":"run","class":"OCA\\DocumentServer\\BackgroundJob\\Cleanup","type":"->","args":[null]},{"file":"/var/www/virtual/*replaced*/html/cron.php","line":127,"function":"execute","class":"OCP\\BackgroundJob\\Job","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]}],"File":"/var/www/virtual/*replaced*/html/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":0,"time":"2022-01-19T07:15:20+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\DocumentServer\\BackgroundJob\\Cleanup job with ID 33 in 0 seconds","userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":0,"time":"2022-01-19T07:15:21+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\Deck\\Cron\\DeleteCron job with ID 167","userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":0,"time":"2022-01-19T07:15:21+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\Deck\\Cron\\DeleteCron job with ID 167 in 0 seconds","userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":0,"time":"2022-01-19T07:15:21+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\Deck\\Cron\\ScheduledNotifications job with ID 168","userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":0,"time":"2022-01-19T07:15:21+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\Deck\\Cron\\ScheduledNotifications job with ID 168 in 0 seconds","userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":0,"time":"2022-01-19T07:15:21+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Run OCA\\Deck\\Cron\\CardDescriptionActivity job with ID 169","userAgent":"--","version":"20.0.11.1"}
{"reqId":"h7F828lUP24bSW69CzU0","level":0,"time":"2022-01-19T07:15:21+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Finished OCA\\Deck\\Cron\\CardDescriptionActivity job with ID 169 in 0 seconds","userAgent":"--","version":"20.0.11.1"}

Edit 3:
pwer’s php 7.3 workaround works for me as well

I am running Nextcloud 20.0.1.1 on Uberspace and have exactly the same issue.

I am having the same issue on uberspace. I will have a closer look this weekend if I find some time.

Yes, I’m on uberspace, too.

This seems to be an issue with PHP 7.4.27. A workaround on Uberspace is to set the default PHP version to 7.3 with the following command:

uberspace tools version use php 7.3

4 Likes

I can confirm that workaround.

that works for me too

This problem alerted me of the fact, that my NC updater somehow got stuck on an old version. I now manually upgraded to NC 22.2.3 and so far it has been working with PHP 7.4.27 as well.

But the updater is still not working.

Any of you got the same problem?

Also on Uberspace and can confirm switching to PHP 7.3 fixed it. Has anyone raised a ticket with them yet?

This worked for me, too.

I am curious what has been changed in PHP 7.4.27, as it is announced to be only a bugfix release. The changelog also does not contain something I would refer to this issue, but I am not that familiar with PHP and may misinterpret this.

However, thanks for pointing me / us to this work-around.

Did anyone find a work around that does not involve downgrading PHP to 7.3? At least on my uberspace server that’s not possible anymore. PHP 7.4 is the oldest version available and I am stuck upgrading Nextcloud due to this issue. Thanks!

Hello,
I had the same problem.
Manual update from nextcloud worked for me.

Greetings Christoph