chazubell has asked for the wisdom of the Perl Monks concerning the following question:

Is there any example code how how to use Log::Message & Log::Handler, etc. The Applications that being written were initially written with Log4Perl (which worked just fine). However, it was found that the servers (running Windows :-o ) which do not have access to the either the Internet or to Make makes installing non-core modules unfeasible.

What I would like to do is put together a simple logger. That said I would first like to see an example of how Log::Messages is used. If any one could point me at some code it would be appreciated.

Thanks.

Replies are listed 'Best First'.
Re: Cannot Use Log4Perl
by ig (Vicar) on Jul 14, 2012 at 01:05 UTC

    I run Strawberry Perl on Windows, including various server versions from 2000 through 2008, and have no problem installing non-core modules - it includes the whole toolchain for building modules. As for Internet access, you can download modules to a system that does have Internet access, copy them over and build them on your target system.

    This is not to suggest that re-doing the logging might not be the best option for you, but I wouldn't want anyone reading your post to think that it's not easy to build non-core modules on Windows systems. Giving up non-core modules is giving up some of the best options for building solutions with Perl. I have never found it easier to do without, even on systems that do not have Internet access.

      Thanks. My Bad.
Re: Cannot Use Log4Perl
by toolic (Bishop) on Jul 14, 2012 at 00:25 UTC
Re: Cannot Use Log4Perl
by Anonymous Monk on Jul 14, 2012 at 06:29 UTC
Re: Cannot Use Log4Perl
by Khen1950fx (Canon) on Jul 15, 2012 at 00:16 UTC
    First, you'll need to make a config file. See: Log::Message::Config.
    # config private => 1, verbose => 1, tag => 'MIXED', level => 'log', remove => 1, chrono => 1,
    Second, setup a simple logger. See: Log::Message.
    #!/usr/bin/perl -l use strict; use warnings; use Log::Message; use Data::Dumper::Concise; my $log = Log::Message->new( config => '/path/to/config', tag => 'MIXED', level => 'log', ); $log->store('This is the first test'); $log->store('This is the second test'); my @items = $log->retrieve(2); print Dumper(@items);
      Thanks for your help.
        Thanks to everybody. It really made me take a deeper look into all the core Log modules.
Re: Cannot Use Log4Perl
by polettix (Vicar) on Jul 14, 2012 at 17:47 UTC
    You can take a look at Log::Log4perl::Tiny, whose aim is to preserve a (IMHO significant) part of the Log::Log4perl interface in a single pm file that you can simply copy in the right place.

    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Io ho capito... ma tu che hai detto?