I've been using Log4perl extensively in a number of scripts. I'd like to augment those scripts to set an error code if any WARN
or ERROR
messages have been logged. I couldn't find any obvious way to do this based on existing documentation.
I'd like to avoid a brute-force rewrite of my existing scripts to add a check on every WARN
or ERROR
log message; I'd prefer to handle it prior to script exit if possible like this pseudocode:
if $log->has_warnings_or_errors then
exit 1
else
exit 0
Is there any easy way to call Log4Perl to determine if the current logger has issues messages of certain levels?