Questions tagged [log4perl]

Log::Log4perl is a Perl module that lets you remote-control and fine-tune the logging behaviour of your system from the outside.

Log::Log4perl lets you remote-control and fine-tune the logging behaviour of your system from the outside. It implements the widely popular (Java-based) log4j logging package in pure Perl.

111 questions
0
votes
2 answers

How to set Log4perl log level on the command line?

Is it possible to set the log level globally for Log4perl by passing a command line flag or setting an environment variable (and not changing the original logging setup)? The documentation and FAQ don't seem to mention any way to do this.
l0b0
  • 55,365
  • 30
  • 138
  • 223
0
votes
1 answer

Change level of Log4perl logger in module from calling script

OK - so I have a module and a script that calls it, that both implement Log4perl. Here is a MWE: test.plx: #!/usr/bin/perl -w use strict; my $logger; BEGIN { eval { require Log::Log4perl; }; if($@) { print "Log::Log4perl not installed -…
ipetrik
  • 1,749
  • 18
  • 28
0
votes
1 answer

getting a name of module or script which logs messages using log4perl

If a particular module is logging using log4perl then is there any way to get the name of that module using log4perl internally. or message is logged from srcipt(.pl) can we get the name of script also using log4perl only apart from using caller or…
Mr_perl
  • 9
  • 3
0
votes
1 answer

How to terminate a Log::Log4perl

I have a root directory which contains multiple sub-directories. I need to traverse all these sub-directories and process its files. I use Log::Log4perl to log messages issued during processing. No multi-processing/forking is used. So far so good,…
MeirG
  • 333
  • 2
  • 14
0
votes
0 answers

Best practice to gracefully fallback in perl module if log4perl not installed

Ok, so I'm trying to learn to properly use log4perl. It seems like it would make sense that I could write a module that uses log4perl, but can also be distributed to a system where log4perl is not installed and still run without failing, just not…
ipetrik
  • 1,749
  • 18
  • 28
0
votes
1 answer

log4perl run from within another package not firing messages sent through email

I'm seeing behavior that I can't explain when using log4perl to send a message by email. So the following test script works just fine and an email is sent without problems: #!/usr/bin/perl use strict; use warnings; use Log::Log4perl qw(:easy); use…
StevieD
  • 6,925
  • 2
  • 25
  • 45
0
votes
1 answer

log4perl How to change the 'Logfile.filename' once read?

I have a .conf file which has log4perl.appender.logFile = Log::Log4perl::Appender::File log4perl.appender.logFile.filename = /myapp/conf/myapp.conf Then, the Perl script consumes it: Log::Log4perl::init($logConf); my $logger =…
user3772839
  • 265
  • 3
  • 11
0
votes
1 answer

Extra Logs from Log4Perl

I am using Log4Perl module for logging. When I run the application I am getting some Log4Perl module logs on console: Subroutine import redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 76. Subroutine initialized redefined at…
Pardeep Singh
  • 412
  • 3
  • 14
0
votes
4 answers

Use Log4Perl in sub routine?

If I make an abstraction function with Log4Perl inside, then it will output the line number where the $logger->error_die($m) line is, and not where the fatalError() function is. sub fatalError { my $m = shift; email($m, $c->{subject}); …
Jasmine Lognnes
  • 6,597
  • 9
  • 38
  • 58
0
votes
1 answer

How to add my own suffix to the log file being rotated in Perl using the log4perl module?

The below code does: Whenever the log file size exceeds 5 MB, create the new log file with the name logfile.log.1, logfile.log.2, etc. But how do I create our own log file name as logfile_20140530_15_31.log using the log4perl module? my $log_conf =…
Venkatesan
  • 422
  • 3
  • 6
  • 19
0
votes
2 answers

How to record FATAL events to separate file with log4perl

I'm using log4perl and I want to record all FATAL events in the separate file. Here is my script: #!/usr/bin/perl use strict; use warnings FATAL => 'all'; use Log::Log4perl qw(get_logger); Log::Log4perl::init('log4perl.conf'); my $l_aa =…
bessarabov
  • 11,151
  • 10
  • 34
  • 59
0
votes
2 answers

Why do differ %M and %F in Log4perl PatternLayout in special cases?

The original question has been reformulated, to be clear for later use I find the following issue to be weird. In some cases %M and %F refers to different files. For example int the following case: Foo.pm contains use warnings; sub x { 2; 1;…
FERcsI
  • 388
  • 1
  • 10
0
votes
1 answer

How to print log level with easy_init in Log4perl?

I sorely miss information on the log level of every line in Log4perl's easy_init. I'm running a large migration script which fails at some special records, so I need to grep for WARNings and ERRORs, but need the INFOrmation context to fix…
Jens Erat
  • 37,523
  • 16
  • 80
  • 96
0
votes
1 answer

I installed a perl module via cpan. But how do i use it?

After lot's of issues I managed to get cpan to work in cygwin. I did: cpan[2]> i Log::Log4perl and it seemed to work. I.e. it downloaded something: cpan[2]> i Log::Log4perl Fetching with LWP: …
Cratylus
  • 52,998
  • 69
  • 209
  • 339
0
votes
1 answer

mysqldump output to log4perl

I have a Perl script that uses log4perl to log everything to file. The config for log4perl is stored in an external file. This script runs the mysqldump command using qx. The output of the mysqldump command is printed to screen (i assume STDERR),…
Quest Monger
  • 8,252
  • 11
  • 37
  • 43