Hi there, On Wed, 29 Oct 2003, Eric Moore wrote:
> I saw a note about redirecting STDERR to the screen but nothing about > sending it to the virtual_host.error_log. Do you really want to do that? Some errors may have nothing to do with a virtual host (no permission, no more filehandles, disc full...) and are more appropriate to the main server error_log. I normally log everything to STDERR, but in the log output I like to put enough information to tell me what the report was about. :) That could include for example something which identifies the virtual host, if a virtual host was involved. I might say: print STDERR "$date_time $script $line $vhost $problem $other_useful_stuff\n" and then split the log later if necessary with something like grep. Actually on a larger project I might have a script especially for logging errors which is called by the other scripts, passing any parameters as necessary. The log script would insert stuff which it can deduce itself (like the date and time) without the need for variables to be passed. This kind of serious attention to logging is probably overkill in the early stages of testing your ideas. I tend to err on the side of verbosity in logs, then cut it down as I get more confident. I have a conditional around the log statements so that I can alter a variable somewhere to change the verbosity of the logging. Sometimes I'll comment out a log statement but rarely will I delete, even if things have been running fine for years. You might want to play with logging through the request or server objects, using the $r->warn() or $r->server->warn() methods. See chapter 9 of the Eagle Book, "Logging Methods" and chapter 16 of the mod_perl Cookbook. Details on the mod_perl website. There are several logging modules on CPAN and you can use Apache's flexible logging facilites too, for example you can log to a pipe and do whatever you want on the fly. Be careful with logging, performance and security may be involved. It's all in the docs. Lots of docs. :) 73, Ged.