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});
unlink $c->{lock};
$logger->error_die($m);
}
fatalError("Directory $d ...");
In Bash have I solved the problem by writing [###]
at the end of each error message, and parse the Bash script after wards to replace [###]
with unique numbers. That way I knew exactly where the error output were from. However it is not optimal to have a second script modify your source code.
Question
Is there a way to have Log4Perl
to write the line number where my fatalError()
function were called, or how should the problem be solved?