So I have 5.3 on IIS (not my choice) and I have logging turned on. The file is writeable and the location is set. If I purposefully introduce an error it will show up on the log. I have reporting set to -1. However, when I trigger_error() or error_log() it simply doesn't show up. It works on other servers.

Any thoughts? I am not great with IIS yet. Used to *nix.

Thanks!

    That seems odd... are you purposefully introducing an error in the same script where you're trying to use either of those functions? Also, can you show us your use of either (or both) functions that isn't showing up in the log?

      they are interspersed throughout the page. I had originally used log functions I wrote but it didn't help in debugging. I am evolving now. I literally just put in error_log("introduced error"); in the script. Even at the beginning I put one. I works on other servers. One of which is an IIS server as well.

      I, for example, removed a ; in a like, which will of course, cause a compile error. I can see the error in the log. Usual Syntax error. on other servers when I there in the error_log(); I get the associated message in the log.

      I even through this in for fun...
      if (1)
      {
      error_reporting(-1);
      ini_set("html_errors", 0);
      ini_set("display_startup_errors", 1);
      ini_set("log_errors", 1);
      ini_set("display_errors", 1);
      ini_set("track_errors",1);
      ini_set("report_memleaks",1);

      }

      nothing in the logs.

      This is a work in progress but...
      private function log($line, $file, $info)
      {
      $file = explode('\',$file);
      $file = array_pop($file);
      $line=sprintf("%5s",$line);
      $errline='Line: '.$line.' File: '.$file.' Message: '.$info;
      $this->
      log[] = $errline;
      if ($this->phpLogDebug)
      {
      $return = error_log($errline);
      }

      if (strpos($errline, 'ERROR') !== false)
      {
        $this->_logError($errline);
      }

      }

        I just realized it is midnight here so I am gonna crash. I will check in the AM. Thanks!

          Have you tried a simple example, e.g. just doing:

          <?php
          
          if(error_log("This is a test."))
              echo "Error logged successfully.";
          else
              echo "An error occurred while logging the error (this just isn't your day)";

            no, but I'll give that a shot. I assumed if it was working it would produce the error.

              5 days later

              ok so I tried that test and I got "Error logged successfully".
              but no message in the log.

              it MUST be logging somewhere else but damned if I know where!

                Okay, so let's make it regurgitate something we think we already know... try this:

                <?php
                
                ini_set('display_errors', 1);
                error_reporting(E_ALL);
                
                if(error_log("This is a test."))
                    echo "Error logged successfully to: " . ini_get('error_log');

                and let us know what the output is. If PHP can't write to the error log, I would suspect that error_log() would return boolean FALSE as well as a PHP error message being emitted.

                If you're seeing that message (meaning error_log() returned TRUE) and there are no other PHP errors hiding in the background (hence why my example above explicitly forced all errors to be displayed), and if the echo statement claims that the error was logged to the same file you're looking at... well then I would be rather confused.

                Make careful note of the output from my latest test script - are you sure you're looking at the same file printed in the output?

                  I am trying...
                  ini_set('error_log','C:\S3kri7\path');
                  to see if that works
                  and it did. so even though in IIS it s specified to go tot he same path as the s3kri7 path it wasn't working. Man I miss unix.

                  thanks though. Good tests. it helped.

                  I am going to do what you just posted as well to see what it was doing.

                    and your test revealed it was a different location. thanks! I totally forgot about the ini_get() function. Now to mark this resolved.

                    thanks!

                      Write a Reply...