Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. WordPress (Developer)
  3. Can I send the Wordpress Debug Log to the Cloudron Logs

Can I send the Wordpress Debug Log to the Cloudron Logs

Scheduled Pinned Locked Moved WordPress (Developer)
8 Posts 2 Posters 1.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • LonkleL Offline
      LonkleL Offline
      Lonkle
      wrote on last edited by
      #1

      I think I can do this via PHP settings. But I have to know the path of the logs to append the PHP / WP errors

      1 Reply Last reply
      0
      • girishG Offline
        girishG Offline
        girish
        Staff
        wrote on last edited by
        #2

        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.

        LonkleL 2 Replies Last reply
        1
        • girishG girish

          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.

          LonkleL Offline
          LonkleL Offline
          Lonkle
          wrote on last edited by
          #3

          @girish Thanks for info, I’ll do that, and yeah, they do write to their own file but that directory is easily changeable. ☺️ I don’t see a reason why your suggestion wouldn’t work tho.

          1 Reply Last reply
          0
          • girishG girish

            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.

            LonkleL Offline
            LonkleL Offline
            Lonkle
            wrote on last edited by
            #4

            @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?

            1 Reply Last reply
            0
            • LonkleL Offline
              LonkleL Offline
              Lonkle
              wrote on last edited by
              #5

              @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' );
              
              1 Reply Last reply
              1
              • girishG Offline
                girishG Offline
                girish
                Staff
                wrote on last edited by
                #6

                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

                LonkleL 2 Replies Last reply
                1
                • girishG girish

                  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

                  LonkleL Offline
                  LonkleL Offline
                  Lonkle
                  wrote on last edited by Lonkle
                  #7

                  @girish Check my comment right about yours, I think we posted at the same time. I'd think it'd be a welcome addition to at least your Wordpress (Developer) installs.

                  1 Reply Last reply
                  0
                  • girishG girish

                    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

                    LonkleL Offline
                    LonkleL Offline
                    Lonkle
                    wrote on last edited by Lonkle
                    #8

                    @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! ☺️

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Bookmarks
                      • Search