From dd1b73d8c4b76d6a5ef7948eff53a8610b20fb31 Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Fri, 24 Sep 2010 07:40:51 +0000 Subject: [PATCH] Debugging for CGIs when using cig-script instead of ModPerl::Registry (this become the default for Debian install) --- build/lemonldap-ng/debian/manager-apache2.conf | 8 ++++++-- modules/lemonldap-ng-common/lemonldap-ng.ini | 5 +++++ .../lemonldap-ng-common/lib/Lemonldap/NG/Common/CGI.pm | 5 ++++- .../lib/Lemonldap/NG/Manager/_i18n.pm | 3 ++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/build/lemonldap-ng/debian/manager-apache2.conf b/build/lemonldap-ng/debian/manager-apache2.conf index aa953214e..e9d59fd9f 100644 --- a/build/lemonldap-ng/debian/manager-apache2.conf +++ b/build/lemonldap-ng/debian/manager-apache2.conf @@ -12,8 +12,12 @@ # Manager must be interpreted by Perl - SetHandler perl-script - PerlResponseHandler ModPerl::Registry + + # To avoid Manager stay in memory, default is to use cgi-script + SetHandler cgi-script + # For best performances, use the following instead: + #SetHandler perl-script + #PerlResponseHandler ModPerl::Registry diff --git a/modules/lemonldap-ng-common/lemonldap-ng.ini b/modules/lemonldap-ng-common/lemonldap-ng.ini index 4e88c6edb..3ac58e971 100644 --- a/modules/lemonldap-ng-common/lemonldap-ng.ini +++ b/modules/lemonldap-ng-common/lemonldap-ng.ini @@ -202,6 +202,11 @@ status = 0 # * 'rule: : you can set here directly the rule to apply ;protection = manager +# When using "SetHandler cgi-script" instead of using ModPerl::Registry, +# Apache LogLevel parameter does not work for Lemonldap::NG debugging. +# Use the following to modify error output: +;hideLogLevels = debug|info + [apply] # URL used to reload configuration diff --git a/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/CGI.pm b/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/CGI.pm index 02c118963..31827a1f2 100644 --- a/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/CGI.pm +++ b/modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/CGI.pm @@ -96,7 +96,10 @@ sub lmLog { } } else { - print STDERR "$mess\n" unless ( $level =~ /^(?:debug)$/ ); + $self->{hideLogLevels} = 'debug|info' + unless defined( $self->{hideLogLevels} ); + print STDERR "[$level] $mess\n" + unless ( $level =~ /^(?:$self->{hideLogLevels})$/ ); } } diff --git a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm index 37c4f275c..0f52dc620 100644 --- a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm +++ b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm @@ -31,7 +31,8 @@ sub translate { return $r; } else { - print STDERR __PACKAGE__ . ": $text not translated in $_\n"; + $self->lmLog( __PACKAGE__ . ": $text not translated in $_", + 'error' ); return $text; } }