Search code examples
perllog4perl

Log4perl: new message in the same line without prefix


Each Log4perl message starts with a new line:

my $log = Log::Log4perl->get_logger("log");
$log->info("start:");
$log->info("10");
$log->info("20");
$log->info("30");

result:

[2012/07/06 13:12:27] INFO log - start:
[2012/07/06 13:12:27] INFO log - 10
[2012/07/06 13:12:27] INFO log - 20
[2012/07/06 13:12:27] INFO log - 30

How can I get next messages on the same line and without prefix:

[2012/07/06 13:12:27] INFO log - start: 10 20 30

Any ideas?

UPD:

I tried to make progress bar for my program. But as a result I need this progress bar only on screen, not at logs.

In this way I did so:

$log->info("start");
printf("progress: ");
printf("10");
printf("20");
printf("30");

Thank you for your answers!


Solution

  • If you need a progress bar there is Term::ProgressBar in cpan