We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Sets up a Cron job to automatically purge the error log and email you the contents at regular intervals:


    http://www.jamescaws.co.uk/2008/07/automatically-email-php-error-log-content/

      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
    • That is a pretty cool idea. Or write it to a file and email you the link.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 3749
        • 24,544 Posts
        It looks like there no way out of setting up the Cron job manually, but after that, everything’s automatic.

        I imagine it wouldn’t be too hard to have a plugin instead that was triggered by manager login. It could check how long it’s been since the last time and run a snippet that could be configured to do what you want.

        I’m thinking of having SPForm run something like this (it has it’s own error log) when triggered by the form’s entries (e.g. subject = "sendAndClearLog").

        BTW, it’s really easy to have a snippet use its own error_log, which can be really handy for debugging or logging anything you want without messing up the screen output.

         ini_set("error_log", 'assets/snippets/snippet_name/error.log");


        Then, any line like the following writes to that log:

        error_log("error message");


          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
        • Why not have it triggered by a site visit to a page instead of a manager login. PseudoCron on Wordpress works this way.
            Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. BlogTwitterLinkedInGitHub
          • Just FYI, we have a message queue for these things in Revo, complete with a polling function that listens for x number of messages or for x amount of time, though it’s not something you would want to use on a shared server exactly (though if used properly can be very unobtrusive, despite PHP being a terrible language for implementing daemon processes).  It’s called modRegistry, and this "Message Registry" consists of any number of "Registers" into which you can send/receive (i.e. register) messages, organized into a topic structure (i.e. hierarchical).  This is used, for instance, to log xPDO/MODx messages (from $modx->log()) into a topic and then retrieve them for display into a real-time console when you install an Add-On Package in Revolution.  You can define your own register classes and the usage couldn’t be simpler.

            This will be useful for posting messages into topics which other requests can look for by "subscribing" to a Topic in a specific Register and attempting to read any "unread" messages.  Each register can define how it stores and retrieves the messages, and the default modFileRegister simply stores them on the file system as PHP files that can be included.  Core Extensions will be able to define custom Register classes and extend this functionality.
              • 3749
              • 24,544 Posts
              Quote from: smashingred at Oct 17, 2008, 12:11 AM

              Why not have it triggered by a site visit to a page instead of a manager login. PseudoCron on Wordpress works this way.

              I would think crawler bots would trigger that accidentally -- maybe not such a bad thing, though.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 10449
                • 956 Posts
                A good way to setup a pseudo-cron in modx is to append that snippet to the sitemap.xml doc - it’s only accessed once a day by Google, doesn’t appear in menus or searches ("show in menu" = no).
                • Good call ganeshXL.

                  I think you guys will have a blast with the new registry in Revo. This is a very cool stuff, a simple "message bus" like Mule or Amazon SQS. I hesitate to use the "E" word (enterprise) but it really leans that way!
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me