Log::Agent::Driver::Apache - Use mod_perl with standard logger.


Log-Agent-Driver-Apache documentation  | view source Contained in the Log-Agent-Driver-Apache distribution.

Index


NAME

Top

Log::Agent::Driver::Apache - Use mod_perl with standard logger.

SYNOPSIS

Top

	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");

DESCRIPTION

Top

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.

EXPORT

None, this is a driver for Log::Agent.

METHODS

make(%options)

This is the constructor for this driver, using the Log::Agent convention of prefixing option keys with a dash.

Options are

-log

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.

channel_eq()

Always returns true. (Even if apache is configured in ways that involve multiple files/logs)

Log::Agent::Driver requires this method.

write($channel,$priority,$logstring)

This is the required Log::Agent::Driver->write() method, after the priority has been mapped, it calls on a method of Apache::Log::Server.

SEE ALSO

Top

Log::Agent Log::Agent::Driver mod_perl Apache2::Log

h2xs suggested I have a web site for modules. Here is one: http://www.geniegate.com/other/log_agent/.

AUTHOR

Top

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 AND LICENSE

Top

BUGS

Top

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.


Log-Agent-Driver-Apache documentation  | view source Contained in the Log-Agent-Driver-Apache distribution.