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?
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With