11 Sep 2005 15:36:14 UTC
- Distribution: Log-Agent-Driver-Apache
- Module version: 0.002
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (11 / 0 / 15)
- KwaliteeBus factor: 0
- 87.50% Coverage
- License: unknown
- Activity24 month
- Download (4.48KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionJMHOGLUND Jamie Hoglund
Log::Agent::Driver::Apache - Use mod_perl with standard logger.
use Log::Agent; use Log::Agent::Driver::Apache; .. # Make the driver. my $driver = Log::Agent::Driver::Apache->make(); # Tell Log::Agent to use it. logconfig(-driver => $driver); # later on, in the vastness name-space, far far away.. logerr("Use the source, Luke");
A Log::Agent::Driver module for Apache.
Since Log::Agent is the standard way for modules to log output, or rather it's supposed to be, but Apache with mod_perl has different ideas about logging, this module attempts to translate Log::Agent calls over to Apache::Log.
Part of a bigger project to port some older mod_perl stuff to the newer mod_perl 2.0, I thought CPAN might have a use for this.
One of the advantages of this style is that you can use a different driver for Log::Agent for out-of-apache testing, use this driver while running under mod_perl. Any modules you may have that are not tied to mod_perl can continue to run in both environments. Later on, if your mod_perl application grows or you feel some need to switch to a syslog style logger, just use one of the other Log::Agent drivers.
None, this is a driver for Log::Agent.
This is the constructor for this driver, using the Log::Agent convention of prefixing option keys with a dash.
An Apache2::Log::Request or Apache2::Log::Server object. This is optional and defaults to an Apache2::Log::Server object. I wouldn't set this to an Apache2::Log::Request if I were you, unless you were prepared to configure it on each request.
Note that the default is the main server, not a virtual host.
Always returns true. (Even if apache is configured in ways that involve multiple files/logs)
Log::Agent::Driver requires this method.
This is the required Log::Agent::Driver->write() method, after the priority has been mapped, it calls on a method of Apache::Log::Server.
h2xs suggested I have a web site for modules. Here is one: http://www.geniegate.com/other/log_agent/.
Jamie Hoglund http://www.geniegate.com/contact.php
Cough, it sounds like "hoaglund" :-)
(I won't use my email address for fear of overworking my poor old machine running spam assassin. Sorry!)
Copyright (C) 2005 by Jamie Hoglund
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available. (Actually, it'll probably work with earlier versions too.)
I'm not real happy with the way it defaults to using an Apache::Log::Server object for logging. Using an Apache::Log::Request would mean reconfiguring the driver in each handler instance (Which would make it inconvenient to use.)
There are probably other bugs waiting to be uncovered.
Module Install Instructions
To install Log::Agent::Driver::Apache, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Log::Agent::Driver::Apache
For more information on module installation, please visit the detailed CPAN module installation guide.