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
2
votes
2 answers

How to create separate log files?

I'm using Log::Log4perl to create log files, but it is appending to a single log file; instead, I want to create a separate log file for each execution of my script. How can I create separate log files ? Here is my code : fetch.pl #Opening Log…
Naghaveer R
  • 2,890
  • 4
  • 30
  • 52
2
votes
1 answer

log4perl multiple configs in a single conf file

Can i have multiple configurations specified in a single conf file? i have specified something like this log4perl.category.xml_script = DEBUG, LOGFILE_XML_SCRIPT log4perl.category.xml_script.XML_script_lib = DEBUG,…
justrajdeep
  • 855
  • 3
  • 12
  • 29
2
votes
1 answer

How can I get %x in Log4perl to not show "[undef]"?

When I haven't pushed anything to the Log::Log4perl::NDC stack, %x returns [undef]. I would like it to return an empty string when the stack is empty. For example, take this code: use strict; use Log::Log4perl qw(:easy); Log::Log4perl->easy_init({…
Flimm
  • 136,138
  • 45
  • 251
  • 267
2
votes
1 answer

Is it possible to use Log4perl to create per user log files?

I have a mojolicious web app that uses Log4perl for logging. It is a multi user application and sometimes it is difficult to follow the various threads in log file when more than one user is accessing the application. What I would like to do is…
Todd
  • 698
  • 6
  • 19
2
votes
2 answers

Can not create a basic logger in Perl

I am reading about Log4Perl from perl.com I am trying to follow the tutorial but got "lost" in the part Logger Categories. I tried to follow the tutorial and did the following scripts: I created a directory Groceries and inside I created a pm file…
Jim
  • 18,826
  • 34
  • 135
  • 254
2
votes
1 answer

Log4perl configuration is not working

I have Log4perl installed on my Linux machine and have the following /path/to/log4perl.conf: log4perl.logger.Fizz = INFO, FizzAppender log4perl.logger.Buzz = INFO, BuzzAppender log4perl.appender.FizzAppender =…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
2
votes
1 answer

Perl: Log4Perl call log4perl in case of unhandled error

Is there a way in log4Perl that I can force my programs to log fatal even outside an eval clause? I want to achieve to call log4perl also in case of any unhandled program termination. Prefereably I would like to add the related error handler inside…
weismat
  • 7,195
  • 3
  • 43
  • 58
2
votes
2 answers

Log4Perl: How do I change the logger file used from running code? (After a fork)

I have an ETL process set up in perl to process a number of files, and load them to a database. Recently, for performance reasons I set up the code to be multi-threaded, through use of a fork() call and a call to system("perl…
Panky
  • 563
  • 1
  • 3
  • 18
1
vote
1 answer

Perl Log4perl Printing and logging at the same time in a line

I'm reading this and I am confused and stuck. Should I use ALWAYS or print_portfolio('themessage') to both print and log into a file at the same time? What I want to do: if ($logfile) { open (FILE, '>>', "logfile"); print "Hello" #some code…
John Tan
  • 509
  • 3
  • 8
  • 19
1
vote
1 answer

Log4perl inside a package with custom appender filename

I would like to use Log4perl inside a package to log messages to a custom filename and to the screen. My mail file test.pl: #!/usr/bin/env perl use lib '.'; use MyPackage; helloWorld(); My package file MyPackage.pm: package MyPackage; use…
h q
  • 1,168
  • 2
  • 10
  • 23
1
vote
0 answers

Using Log4perl, can I convince it to use a higher stack frame for package/function/line number data?

I have a logging module in my code which uses Log::Log4perl and basically does all the initialization stuff so the calling code doesn't need to worry about it, basically the caller does: use PI3::Log qw(:all); my $log_main =…
1
vote
1 answer

Log::Log4Perl different logging destination depending on LogLevel

My goal is, to log "debug"-messages (and subsequent levels: info,warning, fatal,...) to a file but only "warnings"/fatal/error to the screen. Both at the same time. I tried with easy_init ("stealth logging"): Log::Log4perl->easy_init( { level =>…
MacMartin
  • 2,366
  • 1
  • 24
  • 27
1
vote
1 answer

How to switch between different log4perl configurations?

I'm using log4perl with a set of scripts and objects. I'd like to be able to switch between different logging configurations according command line or environment parameters, e.g. in 'verbose' mode, print out all messages from INFO level upwards, a…
i alarmed alien
  • 9,412
  • 3
  • 27
  • 40
1
vote
1 answer

How to get appender file name using logger object?

I want to get appender file name using logger object. my $log_conf = { 'log4perl.rootLogger' => "DEBUG, LOG1, SCREEN", 'log4perl.appender.SCREEN' => "Log::Log4perl::Appender::Screen", 'log4perl.appender.SCREEN.stderr' =>…
user8757355
1
vote
1 answer

Log4perl: separate INFO and ERROR files using easy_init

I am currently sending INFO and above to STDOUT using: Log::Log4perl->easy_init({level=>("$INFO"), layout=>"%d %p - %m%n", file=>"STDOUT"}); How can I send ERROR and above to STDERR?
dogbane
  • 266,786
  • 75
  • 396
  • 414