Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install and use log4perl?

Tags:

perl

log4perl

I am new to using log4p and want to use the same for logging in my code. I am getting errors like:

Can't locate Log/Log4perl.pm in @INC

Which I understand is because of a missing library. Now, where and how do i get this library installed on my UNIX environment?

I tried installing:

yum install perl-Log-Log4perl-1.30-1.el6.noarch.rpm

This also failed. Am I not in the right track? Can someone give me a quick start up link which also tells how to install this package and from where?

like image 231
learner Avatar asked Jan 23 '13 01:01

learner


People also ask

Does Log4perl use Log4j?

Log4j is a very popular logging framework for Java developers, used by most Java applications. It has been ported to other programming languages including log4perl, log4php, log4net, and log4r.

What is the main purpose of using loggers in Perl?

In the most simple case we use it to add logging messages to a script. We need to load the module importing the :easy key that will import 6 functions for the 6 logging levels provided by Log::Log4perl and 6 variables with corresponding names. In the code we can use any of the 6 methods to send logging messages.


1 Answers

The typical way to install packages for perl is to use cpan or its variations (cpanm, cpanp, etc). If it is packaged by your distro thats easier/faster, but if it is not, you would still be able to do it via cpan.

cpan Log::Log4perl

OR in a DOS command prompt enter

> cpan
> install Log::Log4perl

You can look up the packages you want and their exact package names at search.cpan.org

Check Wikipedia for information about CPAN

like image 117
Karthik T Avatar answered Oct 01 '22 17:10

Karthik T