Plack::Middleware::Log4perl(3pm)

Plack::Middleware::Log4perl3pm

Uses log::log4perl to configure logger

Usage

  my $app = sub {
      my $env =  shift;
      $env->{'psgix.logger'}({ level => 'error', message => 'Hi' });
      return [
          '200',
          [ 'Content-Type' => 'text/plain' ],
          [ "Hello World" ],
      ];
  };
  # Use your own Log4perl configuration
  use Log::Log4perl;
  Log::Log4perl::init('/path/to/log4perl.conf');
  builder {
      # tell the logger to log with 'plack' category
      enable "Log4perl", category => "plack";
      $app;
  }
  # Configure with Log4perl middleware options
  builder {
      enable "Log4perl", category => "plack", conf => '/path/to/log4perl.conf';
      $app;
  }

Overview

Log4perl is a Plack::Middleware component that allows you to use Log::Log4perl to configure the logging object "psgix.logger" for a given category.

Configuration

category

The "log4perl" category to send logs to. Defaults to '' which means it send to the root logger.

conf

The configuration file path (or a scalar ref containing the config string) for Log::Log4perl to automatically configure.

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 7 times.

  1. 6.0
  2. 7
  3. 8
  4. 9
  5. 10
  6. 11
  7. 12
  8. 13

Author

Tatsuhiko Miyagawa

From libplack-perl 1.0051-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.