Problem:
Errors generated by Perl scripts are not displayed or logged in an Azure web application.
Steps to reproduce:
Install Strawberry Perl to an Azure web application, using this guide.
The most relevant part of that guide being that I have Perl configured as a handler for the .pl extension, using
perl.exe
with an argument of-MFCGI::IIS=do
.Enable logging to local file system (error level: verbose).
Enable detailed error messages and Failed Request Tracing.
Run the following test script in a browser:
use strict; use warnings; use diagnostics; use CGI::Carp 'fatalsToBrowser'; use CGI; my $q = new CGI; print $q->header(-type => "text/plain"); print "Hello, World!\n"; die "This is a test"; print "End of script.";
My results:
Script halts after "Hello, World!" ("End of script" and "This is a test" are not displayed).
"This is a test" is not found in any log file in the /LogFiles directory.
Things I have Verified
Strawberry Perl runs when executed via the command line (using Kudu).
When run using the command line, the script produces expected results:
[Thu Mar 10 16:09:30 2016] azure-test.pl: This is a test at d:\home\site\wwwroot\cgi-bin\azure-test.pl line 12. Content-Type: text/plain; charset=ISO-8859-1 Hello, World! <h1>Software error:</h1> <pre>This is a test at d:\home\site\wwwroot\cgi-bin\azure-test.pl line 12. </pre> <p> For help, please send mail to this site's webmaster, giving this error message and the time and date of the error. </p>
Why Can't I Just use Perl to View the Errors?
A different section of code is failing in Azure, but not in Perl. I need to see the errors generated in the Azure environment in order to troubleshoot it.