package MyLogger; # Wrapper class for Log::Log4perl. use strict; use warnings; use fields; use Log::Log4perl; my $log; my $module_name; sub new { # initialize and return MyLogger object my MyLogger $self = shift; unless (ref $self) { $self = fields::new ($self); } $module_name = shift; if (!Log::Log4perl::initialized()) { Log::Log4perl->init("/opt/etc/log4perl.conf"); $Log::Log4perl::caller_depth = 1; } $log = Log::Log4perl->get_logger($module_name); return $self; } sub debug{ # log a single message my ($self, $logmsg) = @_; $log->debug($logmsg); } ...