Can I send the Wordpress Debug Log to the Cloudron Logs
-
Cloudron logs is anything that appears on standard output/error. If there is a way to send WP logs to stdout, then it should appear. FWIW, if i use error_log in PHP, it does appear in cloudron logs. But maybe WP writes to a file directly. Maybe try
/dev/stdout
as the file name for the logs, not sure. -
@girish By defaut, Wordpress does a:
ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
And I don't think it would be a bad idea for you guys to add to your custom plugin an
ini_set( 'error_log', '/dev/stdout' );
(this would need go into a plguin to load after WP sets it's PHP logging location).But, though I can now use
ini_set( 'error_log', '/app/data/ . $path);
to write the logs to to any location within/app/data
- I tried setting it to/dev/stdout
didn't start displaying the logs in Cloudron's Realtime Logging system. Any idea why I could change it to any directory and it worked, but that didn't? -
@Lonk said in Can I send the Wordpress Debug Log to the Cloudron Logs:
ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
Did a little digging around some more Docker stuff and this worked perfectly:
ini_set( 'error_log', '/dev/stderr' );
-
I think it's most likely permissions related. That
/dev/stdout
is probably not opeable by non-root user (and WP runs as www-data user).I have long wanted to fix our situation that we can get the logs from files inside containers. For example, nextcloud also logs into /run/nextcloud/logs/... It's a pain to keep informing users that the logs are in that file and not just the Cloudron logs.
I agree we should visit this at some point for better logging
-
@girish said in Can I send the Wordpress Debug Log to the Cloudron Logs:
I agree we should visit this at some point for better logging
This fixes the Wordpress "custom log path issue". But I do think we should revisit in the future about other apps and how we might be able to symlink the logs together. Anyway, you got me 75% there on this one, so thank you for that! ️