On Fri, Mar 28, 2014 at 8:01 AM, punit jain <contactpunitj...@gmail.com>wrote:

> Attempt to bless into a reference at
> /root/scripts/bin/../lib/Log/Log4perl/Logger.pm line 143.
>

Not really but:
 Why "Log::Log4perl->get_logger" and not "Log::Log4perl->new"? We don't
want to create a new
       object every time. Usually in OO-Programming, you create an object
once and use the
       reference to it to call its methods. However, this requires that you
pass around the object
       to all functions and the last thing we want is pollute each and
every function/method we're
       using with a handle to the "Logger":

           sub function {  # Brrrr!!
               my($logger, $some, $other, $parameters) = @_;
           }

       Instead, if a function/method wants a reference to the logger, it
just calls the Logger's
       static "get_logger($category)" method to obtain a reference to the
one and only possible
       logger object of a certain category.  That's called a singleton if
you're a Gamma fan.



and so:
#$logger->get_logger('LOG2');
$logger = Log::Log4perl->get_logger('LOG2');

seems to work.



-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk

Reply via email to