On Mon, 26 Jul 2010, Andres wrote:

> When I troubleshoot AGI scripts, I output stuff to text files for 
> debugging purposes.  I suggest you output all your variables to a file 
> and then you will learn if the variables do have the info you need.
>
> Something like: $message="/bin/echo my variables are '$loc', 
> '$variable1', '$variable2', etc >> /tmp/variables.txt"; 
> system("$message");

I prefer syslog().

) You don't litter your system with little files.

) You get nicely timestamped messages you can centralize across servers.

) You can control how much "verbosity" you want by setting the logging 
priority.

) You can vary the logging priority at run time.

) You can leave the logging code in place in production.

I code all of my AGIs to recognize (via getopt_long()) --debug and 
--verbose command line options. When something weird starts to happen, I 
can enable debugging in the dialplan and debug the code that is running in 
production.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       [email protected]      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to