Depending on the the current LogLevel setting, only logging with the same log level or higher will be loaded. For example if the current LogLevel is set to warning, only messages with log level of the level warning or higher (err, crit, elert and emerg) will be logged. Therefore this:

It will be logged only if the server log level is set to info or debug. LogLevel is set in the configuration file, but can be changed using the $s->loglevel() method.

The filename and the line number of the caller are logged only if Apache2::Const::LOG_DEBUG is used (because that's how Apache 2.0 logging mechanism works).

Note: On Win32 Apache attempts to lock all writes to a file whenever it's opened for append (which is the case with logging functions), as Unix has this behavior built-in, while Win32 does not. Therefore Apache2::Log functions could be slower than Perl's print()/warn().

used to give content handlers the option of including the error text in the ErrorDocument sent back to the client. When Apache2::Const::LOG_TOCLIENT is passed to log_rerror() the error message will be saved in the $r's notes table, keyed to the string "error-notes", if and only if the severity level of the message is Apache2::Const::LOG_WARNING or greater and there are no other "error-notes" entry already set in the request record's notes table. Once the "error-notes" entry is set, it is up to the error handler to determine whether this text should be sent back to the client. For example:

Code running from within a virtual host needs to be able to log into its ErrorLog file, if different from the main log. Calling any of the logging methods on the $r and $s objects will do the logging correctly.

If the core warn() is called, it'll be always logged to the main log file. Here is how to make it log into the vhost error_log file. Let's say that we start with the following code:

warn "the code is smoking";

First, we need to use mod_perl's logging function, instead of CORE::warn

Outside HTTP handlers at the moment it is not possible, to get hold of the vhost's error_log file. This shouldn't be a problem for the code that runs only under mod_perl, since the always available $s object can invoke a plethora of methods supplied by Apache2::Log. This is only a problem for modules, which are supposed to run outside mod_perl as well.

META: To solve this we think to introduce 'PerlOptions +GlobalServer', a big brother for 'PerlOptions +GlobalRequest', which will be set in modperl_hook_pre_connection.

Apache2::Log also provides auto-generated Perl interface for a few other methods which aren't tested at the moment and therefore their API is a subject to change. These methods will be finalized later as a need arises. If you want to rely on any of the following methods please contact the the mod_perl development mailing list so we can help each other take the steps necessary to shift the method to an officially supported API.

META: what is this method good for? it just calls getpid and logs it. In any case it has nothing to do with the logging API. And it uses static variables, it probably shouldn't be in the Apache public API.