Logs don’t show up
Solved
Nextcloud
-
On a fresh install:
Settings > manage > Logs: no logs are showing and it keeps “loading”
Am I doing something wrong?
-
I see an error in the logs when opening the logs page:
12:27:20 - [Mon May 24 19:27:20.726135 2021] [php7:notice] [pid 187] [client 172.18.0.1:40788] {"reqId":"8y2bs86iKtNb2NRBPa6q","level":3,"time":"2021-05-24T19:27:20+00:00","remoteAddr":"69.181.254.26","user":"admin","app":"PHP","method":"GET","url":"/apps/logreader/get?offset=0&count=50&levels=11111","message":{"Exception":"Error","Message":"fopen(/dev/stderr): failed to open stream: No such file or directory at /app/data/apps/logreader/lib/Log/LogIteratorFactory.php#52","Code":0,"Trace":[{"function":"onError","class":"OC\\\\Log\\\\ErrorHandler","type":"::"},{"file":"/app/data/apps/logreader/lib/Log/LogIteratorFactory.php","line":52,"function":"fopen"},{"file":"/app/data/apps/logreader/lib/Controller/LogController.php","line":61,"function":"getLogIterator","class":"OCA\\\\LogReader\\\\Log\\\\LogIteratorFactory","type":"->"},{"file":"/app/code/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"get","class":"OCA\\\\LogReader\\\\Controller\\\\LogController","type":"->"},{"file":"/app/code/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\\\AppFramework\\\\Http\\\\Dispatcher","type":"->"},{"file":"/app/code/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\\\AppFramework\\\\Http\\\\Dispatcher","type":"->"},{"file":"/app/code/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\\\AppFramework\\\\App","type":"::"},{"file":"/app/code/lib/base.php","line":993,"function":"match","class":"OC\\\\Route\\\\Router","type":"->"},{"file":"/app/code/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/app/code/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1"} 12:27:20 - [Mon May 24 19:27:20.727333 2021] [php7:notice] [pid 187] [client 172.18.0.1:40788] {"reqId":"8y2bs86iKtNb2NRBPa6q","level":3,"time":"2021-05-24T19:27:20+00:00","remoteAddr":"69.181.254.26","user":"admin","app":"index","method":"GET","url":"/apps/logreader/get?offset=0&count=50&levels=11111","message":{"Exception":"Exception","Message":"Error while opening /dev/stderr","Code":0,"Trace":[{"file":"/app/data/apps/logreader/lib/Controller/LogController.php","line":61,"function":"getLogIterator","class":"OCA\\\\LogReader\\\\Log\\\\LogIteratorFactory","type":"->"},{"file":"/app/code/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"get","class":"OCA\\\\LogReader\\\\Controller\\\\LogController","type":"->"},{"file":"/app/code/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\\\AppFramework\\\\Http\\\\Dispatcher","type":"->"},{"file":"/app/code/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\\\AppFramework\\\\Http\\\\Dispatcher","type":"->"},{"file":"/app/code/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\\\AppFramework\\\\App","type":"::"},{"file":"/app/code/lib/base.php","line":993,"function":"match","class":"OC\\\\Route\\\\Router","type":"->"},{"file":"/app/code/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/app/data/apps/logreader/lib/Log/LogIteratorFactory.php","Line":59,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1"} 12:27:20 - [Mon May 24 19:27:20.751521 2021] [php7:notice] [pid 187] [client 172.18.0.1:40788] {"reqId":"8y2bs86iKtNb2NRBPa6q","level":3,"time":"2021-05-24T19:27:20+00:00","remoteAddr":"69.181.254.26","user":"admin","app":"PHP","method":"GET","url":"/apps/logreader/get?offset=0&count=50&levels=11111","message":"fopen(/dev/stderr): failed to open stream: No such file or directory at /app/code/lib/private/Log/File.php#85","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0","version":"21.0.2.1"}
-
The root cause is that the nextcloud package is configured to log to the console (stdout / stderr) instead of a file. Nextcloud tries to open the stdout/stderr and this fails. Ideally, nextcloud can show a graceful error message that logs cannot be viewed from inside the app because it is logging to the console. Workaround is to use the cloudron logs viewer to view the logs - which IMO is the correct place to view logs (for all apps and not just nextcloud). After all, if the app is not working, one cannot view the logs within itself.