[Catalyst] Redirecting Catalyst's Log to a File

Tomas Doran bobtfish at bobtfish.net
Mon Mar 8 23:51:18 GMT 2010


On 8 Mar 2010, at 09:14, John Karr wrote:

> I'm having a problem with deploying a Catalyst application (I'm  
> learning
> Catalyst and this is the first application I've tried to put on the  
> web, and
> it works on my test machine which has a similar configuration to my  
> ISP, but
> just times-out at my isp returning nothing), and need to capture the  
> logging
> output from the fastcgi script to a file instead of the apache log.

Right. That is very likely to indicate that your app isn't getting as  
far as even starting.

Ergo, redirecting your logging as likely to fail, as your app never  
gets loaded far enough to load a log class.

I'd recommend finding the error log (you should be able to download it  
from somewhere even if you don't have shell access?)..

But if all else fails, try something like the attached patch.. That'll  
log compile errors in your app into a known location you can then FTP  
back..

Good luck!
t0m


-------------- next part --------------
diff --git a/script/foo_fastcgi.pl b/script/foo_fastcgi.pl
index f38c614..0957a98 100755
--- a/script/foo_fastcgi.pl
+++ b/script/foo_fastcgi.pl
@@ -1,7 +1,15 @@
 #!/usr/bin/env perl
 
-use Catalyst::ScriptRunner;
-Catalyst::ScriptRunner->run('Foo', 'FastCGI');
+eval {
+    require Catalyst::ScriptRunner;
+    Catalyst::ScriptRunner->run('Foo', 'FastCGI');
+};
+
+if ($@) {
+    open(FAIL, '>/home/myuser/faillog.txt');
+    print FAIL, $@;
+    close(FAIL);
+}
 
 1;
 
-------------- next part --------------



More information about the Catalyst mailing list