| 1 |
NAME |
| 2 |
Catalyst::Log::Log4perl - DEPRECATED (see Log::Log4perl::Catalyst) |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
In MyApp.pm: |
| 6 |
|
| 7 |
use Catalyst::Log::Log4perl; |
| 8 |
|
| 9 |
# then we create a custom logger object for catalyst to use. |
| 10 |
# If we don't supply any arguments to new, it will work almost |
| 11 |
# like the default catalyst-logger. |
| 12 |
|
| 13 |
__PACKAGE__->log(Catalyst::Log::Log4perl->new()); |
| 14 |
|
| 15 |
# But the real power of Log4perl lies in the configuration, so |
| 16 |
# lets try that. example.conf is included in the distribution, |
| 17 |
# alongside the README and Changes. |
| 18 |
|
| 19 |
__PACKAGE__->log(Catalyst::Log::Log4perl->new('example.conf')); |
| 20 |
|
| 21 |
And later... |
| 22 |
|
| 23 |
$c->log->debug("This is using log4perl!"); |
| 24 |
|
| 25 |
DESCRIPTION |
| 26 |
This module provides a Catalyst::Log implementation that uses |
| 27 |
Log::Log4perl as the underlying log mechanism. It provides all the |
| 28 |
methods listed in Catalyst::Log, with the exception of: |
| 29 |
|
| 30 |
levels |
| 31 |
enable |
| 32 |
disable |
| 33 |
|
| 34 |
These methods simply return 0 and do nothing, as similar functionality |
| 35 |
is already provided by Log::Log4perl. |
| 36 |
|
| 37 |
These methods will all instantiate a logger with the component set to |
| 38 |
the package who called it. For example, if you were in the |
| 39 |
MyApp::C::Main package, the following: |
| 40 |
|
| 41 |
package MyApp::C::Main; |
| 42 |
|
| 43 |
sub default : Private { |
| 44 |
my ( $self, $c ) = @_; |
| 45 |
my $logger = $c->log; |
| 46 |
$logger->debug("Woot!"); |
| 47 |
} |
| 48 |
|
| 49 |
Would send a message to the Myapp.C.Main Log::Log4perl component. |
| 50 |
|
| 51 |
See Log::Log4perl for more information on how to configure different |
| 52 |
logging mechanisms based on the component. |
| 53 |
|
| 54 |
METHODS |
| 55 |
new($config, [%options]) |
| 56 |
This builds a new Catalyst::Log::Log4perl object. If you provide an |
| 57 |
argument to new(), it will be passed directly to |
| 58 |
Log::Log4perl::init. |
| 59 |
|
| 60 |
The second (optional) parameter is a hash with extra options. |
| 61 |
Currently three additional parameters are defined: |
| 62 |
|
| 63 |
'autoflush' - Set it to a true value to disable abort(1) support. |
| 64 |
'watch_delay' - Set it to a true value to use L<Log::Log4perl>'s init_and_watch |
| 65 |
|
| 66 |
'override_cspecs' - EXPERIMENTAL |
| 67 |
Set it to a true value to locally override some parts of |
| 68 |
L<Log::Log4perl::Layout::PatternLayout>. See L<OVERRIDING CSPECS> below |
| 69 |
|
| 70 |
Without any arguments, new() will initialize a root logger with a |
| 71 |
single appender, Log::Log4perl::Appender::Screen, configured to have |
| 72 |
an identical layout to the default Catalyst::Log object. |
| 73 |
|
| 74 |
_flush() |
| 75 |
Flushes the cache. Much like the way Catalyst::Log does it. |
| 76 |
|
| 77 |
abort($abort) |
| 78 |
Causes the current log-object to not log anything, effectivly |
| 79 |
shutting up this request, making it disapear from the logs. |
| 80 |
|
| 81 |
debug($message) |
| 82 |
Passes it's arguments to $logger->debug. |
| 83 |
|
| 84 |
info($message) |
| 85 |
Passes it's arguments to $logger->info. |
| 86 |
|
| 87 |
warn($message) |
| 88 |
Passes it's arguments to $logger->warn. |
| 89 |
|
| 90 |
error($message) |
| 91 |
Passes it's arguments to $logger->error. |
| 92 |
|
| 93 |
fatal($message) |
| 94 |
Passes it's arguments to $logger->fatal. |
| 95 |
|
| 96 |
is_debug() |
| 97 |
Calls $logger->is_debug. |
| 98 |
|
| 99 |
is_info() |
| 100 |
Calls $logger->is_info. |
| 101 |
|
| 102 |
is_warn() |
| 103 |
Calls $logger->is_warn. |
| 104 |
|
| 105 |
is_error() |
| 106 |
Calls $logger->is_error. |
| 107 |
|
| 108 |
is_fatal() |
| 109 |
Calls $logger->is_fatal. |
| 110 |
|
| 111 |
levels() |
| 112 |
This method does nothing but return "0". You should use |
| 113 |
Log::Log4perl's built in mechanisms for setting up log levels. |
| 114 |
|
| 115 |
enable() |
| 116 |
This method does nothing but return "0". You should use |
| 117 |
Log::Log4perl's built in mechanisms for enabling log levels. |
| 118 |
|
| 119 |
disable() |
| 120 |
This method does nothing but return "0". You should use |
| 121 |
Log::Log4perl's built in mechanisms for disabling log levels. |
| 122 |
|
| 123 |
OVERRIDING CSPECS |
| 124 |
Due to some fundamental design incompatibilities of Log::Log4perl and |
| 125 |
Catalyst::Log all cspecs of Log::Log4perl::Layout::PatternLayout that |
| 126 |
rely on call stack information fail to work as expected. Affected are |
| 127 |
the format strings %L, %F, %C, %M, %l and %T. You can instruct |
| 128 |
Catalyst::Log::Log4perl to try to hijack these patterns which seems to |
| 129 |
work reasonable well, but be advised that this feature is HIGHLY |
| 130 |
EXPERIMENTAL and relies on a few internals of Log::Log4perl that might |
| 131 |
change in later versions of this library. Additionally, this feature is |
| 132 |
currently only tested with Log::Log4perl version 1.08 allthough the |
| 133 |
underlying internals of Log::Log4perl seem to be stable since at least |
| 134 |
version 0.47. |
| 135 |
|
| 136 |
BUGS AND LIMITATIONS |
| 137 |
The %T cspec of Log::Log4perl::Layout::PatternLayout is currently |
| 138 |
unimplemented. The implementation to get %M defies any logical approach |
| 139 |
but seems to work perfectly. |
| 140 |
|
| 141 |
SEE ALSO |
| 142 |
Log::Log4perl, Catalyst::Log, Catalyst. |
| 143 |
|
| 144 |
AUTHORS |
| 145 |
Adam Jacob, "[email protected]" |
| 146 |
|
| 147 |
Andreas Marienborg, "[email protected]" |
| 148 |
|
| 149 |
Gavin Henry, "[email protected]" (Typos) |
| 150 |
|
| 151 |
Sebastian Willert (Overriding CSPECS) |
| 152 |
|
| 153 |
J. Shirley "[email protected]" (Adding _dump) |
| 154 |
|
| 155 |
Tomas Doran (t0m) "[email protected]" (Current maintainer) |
| 156 |
|
| 157 |
Wallace Reis (wreis) "[email protected]" |
| 158 |
|
| 159 |
COPYRIGHT |
| 160 |
Copyright (c) 2005 - 2009 the Catalyst::Log::Log4perl "AUTHORS" as |
| 161 |
listed above. |
| 162 |
|
| 163 |
LICENSE |
| 164 |
This library is free software. You can redistribute it and/or modify it |
| 165 |
under the same terms as perl itself. |
| 166 |
|