Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
LemonLDAP NG
lemonldap-ng
Commits
c08489a6
Commit
c08489a6
authored
Feb 21, 2017
by
Yadd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Log4perl logger (closes:
#1162
)
parent
e315a447
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
14 deletions
+75
-14
e2e-tests/lemonldap-ng.ini
e2e-tests/lemonldap-ng.ini
+2
-2
lemonldap-ng-common/MANIFEST
lemonldap-ng-common/MANIFEST
+1
-0
lemonldap-ng-common/lemonldap-ng.ini
lemonldap-ng-common/lemonldap-ng.ini
+33
-10
lemonldap-ng-common/lib/Lemonldap/NG/Common/Logger/Log4perl.pm
...ldap-ng-common/lib/Lemonldap/NG/Common/Logger/Log4perl.pm
+33
-0
lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main/Init.pm
lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main/Init.pm
+2
-0
lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm
lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm
+4
-2
No files found.
e2e-tests/lemonldap-ng.ini
View file @
c08489a6
...
...
@@ -23,8 +23,8 @@ portalSkin = bootstrap
staticPrefix
=
/static
languages
=
fr, en
templateDir
=
__pwd__/lemonldap-ng-portal/site/templates
u2fActivation
=
1
u2fSelfRegistration
=
1
;
u2fActivation = 1
;
u2fSelfRegistration = 1
[handler]
...
...
lemonldap-ng-common/MANIFEST
View file @
c08489a6
...
...
@@ -34,6 +34,7 @@ lib/Lemonldap/NG/Common/Conf/Wrapper.pm
lib/Lemonldap/NG/Common/Crypto.pm
lib/Lemonldap/NG/Common/FormEncode.pm
lib/Lemonldap/NG/Common/Logger/Apache2.pm
lib/Lemonldap/NG/Common/Logger/Log4perl.pm
lib/Lemonldap/NG/Common/Logger/Std.pm
lib/Lemonldap/NG/Common/Logger/Syslog.pm
lib/Lemonldap/NG/Common/Module.pm
...
...
lemonldap-ng-common/lemonldap-ng.ini
View file @
c08489a6
...
...
@@ -43,25 +43,48 @@ logLevel = warn
; instead
;
; 2 - Change logger
;
; By default, logging is set to:
; - Lemonldap::NG::Common::Logger::Apache2 for ApacheMP2 handlers
; - Lemonldap::NG::Common::Logger::Syslog for FastCGI (Nginx)
; - Lemonldap::NG::Common::Logger::Std for PSGI applications (manager,
; portal,...) when they are not
; launched by FastCGI server
; Std is redirected to the web server logs for Apache. For Nginx, only if
; - Lemonldap::NG::Common::Logger::Apache2 for ApacheMP2 handlers
; - Lemonldap::NG::Common::Logger::Syslog for FastCGI (Nginx)
; - Lemonldap::NG::Common::Logger::Std for PSGI applications (manager,
; portal,...) when they are not
; launched by FastCGI server
; Other loggers availables:
; - Lemonldap::NG::Common::Logger::Log4perl to use Log4perl
;
; "Std" is redirected to the web server logs for Apache. For Nginx, only if
; request failed
;
; You can overload this in this section (for all) or in another section if
; you want to change logger for specified app.
; you want to change logger for
a
specified app.
;
; LLNG uses 2 loggers: 1 for technical logs (logger), 1 for user actions
; (userLogger)
; (userLogger)
. "userLogger" uses the same class as "logger" if not set.
;logger = Lemonldap::NG::Common::Logger::Syslog
;userLogger = Lemonldap::NG::Common::Logger::Syslog
;userLogger = Lemonldap::NG::Common::Logger::Log4perl
;
; 2.1 - Using Syslog
;
; For Syslog logging, you can also overwrite facilities. Default values:
; For Syslog logging, you can also overwrite facilities. Default values:
;logger = Lemonldap::NG::Common::Logger::Syslog
;syslogFacility = daemon
;userSyslogFacility = auth
;
; 2.2 - Using Log4perl
;
; If you want to use Log4perl, you can set these parameters. Here are default
; values:
;logger = Lemonldap::NG::Common::Logger::Log4perl
;log4perlConfFile = /etc/log4perl.conf
;log4perlLogger = LLNG
;log4perlUserLogger = LLNG.user
;
; Here, Log4perl configuration is read from /etc/log4perl.conf. The "LLNG"
; value points to the logger class. Example:
; log4perl.logger.LLNG = WARN, File1
; log4perl.logger.LLNG.user = INFO, File2
; ...
[configuration]
...
...
lemonldap-ng-common/lib/Lemonldap/NG/Common/Logger/Log4perl.pm
0 → 100644
View file @
c08489a6
package
Lemonldap::NG::Common::Logger::
Log4perl
;
use
strict
;
use
Log::
Log4perl
;
use
Mouse
;
our
$init
=
0
;
sub
new
{
my
(
$class
,
$conf
,
%args
)
=
@_
;
my
$self
=
bless
{},
$class
;
unless
(
$init
)
{
my
$file
=
$conf
->
{
log4perlConfFile
}
||
'
/etc/log4perl.conf
';
Log::
Log4perl
->
init
(
$file
);
$init
++
;
}
my
$logger
=
$args
{
user
}
?
(
$conf
->
{
log4perlUserLogger
}
||
'
LLNG.user
'
)
:
(
$conf
->
{
log4perlLogger
}
||
'
LLNG
'
);
$self
->
{
log
}
=
Log::
Log4perl
->
get_logger
(
$logger
);
return
$self
;
}
sub
AUTOLOAD
{
my
$self
=
shift
;
no
strict
;
$AUTOLOAD
=~
s/.*:://
;
$AUTOLOAD
=~
s/notice/info/
;
return
$self
->
{
log
}
->
$AUTOLOAD
(
@
_
);
}
1
;
lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main/Init.pm
View file @
c08489a6
...
...
@@ -52,10 +52,12 @@ sub logLevelInit {
eval
"
require
$logger
";
die
$@
if
(
$@
);
$class
->
logger
(
$logger
->
new
(
$class
->
localConfig
)
);
$class
->
logger
->
debug
("
Logger
$logger
loaded
");
$logger
=
$class
->
localConfig
->
{
userLogger
}
||
$logger
;
eval
"
require
$logger
";
die
$@
if
(
$@
);
$class
->
userLogger
(
$logger
->
new
(
$class
->
localConfig
),
user
=>
1
);
$class
->
logger
->
debug
("
User logger
$logger
loaded
");
}
# @method void serverSignatureInit
...
...
lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm
View file @
c08489a6
...
...
@@ -32,8 +32,10 @@ sub init {
$args
||=
{};
if
(
my
$localconf
=
$self
->
confAcc
->
getLocalConf
(
MANAGERSECTION
)
)
{
$self
->
{
$_
}
=
$args
->
{
$_
}
//
=
$localconf
->
{
$_
}
foreach
(
grep
{
$_
!~
/^(?:l|userL)ogger$/
}
keys
%$localconf
);
foreach
(
keys
%$localconf
)
{
$args
->
{
$_
}
//
=
$localconf
->
{
$_
};
$self
->
{
$_
}
=
$args
->
{
$_
}
unless
(
/^(?:l|userL)ogger$/
);
}
}
# Manager needs to keep new Ajax behaviour
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment