Thread

Posted on Fri Aug 17 10:45:49 2007 by altis
about Config.pm
Hello,

I'm new in Perl language, and reding through various docs I stumble into the Config.pm file....
It's structure is something as:

############################################################ # A simple root logger with a Log::Log4perl::Appender::File # file appender in Perl. ############################################################ Log4perl.rootLogger=INFO, LOGFILE Log4perl.appender.LOGFILE=Log::Log4perl::Appender::File Log4perl.appender.LOGFILE.filename=C:\myerrs.log Log4perl.appender.LOGFILE.mode=append log4perl.appender.LOGFILE.layout=PatternLayout log4perl.appender.LOGFILE.layout.ConversionPattern=[%r] %F %L %c - %m%n

I saved this file as Config.pm and writed two lines of code:

use Log::Log4perl; Log::Log4perl->init("Config.pm");

trying to initialize the logger. Running these lines in a cmd window I received the folowing output:

Operator or semicolon missing before %F at C:/Perl/site/lib/Log/Log4perl/Config.pm line 13.
Ambiguous use of % resolved as operator % at C:/Perl/site/lib/Log/Log4perl/Config.pm line 13.
Operator or semicolon missing before %L at C:/Perl/site/lib/Log/Log4perl/Config.pm line 13.
Ambiguous use of % resolved as operator % at C:/Perl/site/lib/Log/Log4perl/Config.pm line 13.
Operator or semicolon missing before %c at C:/Perl/site/lib/Log/Log4perl/Config.pm line 13.
Ambiguous use of % resolved as operator % at C:/Perl/site/lib/Log/Log4perl/Config.pm line 13.
Operator or semicolon missing before %n at C:/Perl/site/lib/Log/Log4perl/Config.pm line 13.
Ambiguous use of % resolved as operator % at C:/Perl/site/lib/Log/Log4perl/Config.pm line 13.
Can't modify concatenation (.) or string in scalar assignment at C:/Perl/site/lib/Log/Log4perl/Config.pm line 7, near "INFO,"
syntax error at C:/Perl/site/lib/Log/Log4perl/Config.pm line 10, near "C:"
Compilation failed in require at C:/Perl/site/lib/Log/Log4perl/Appender.pm line 10.
BEGIN failed--compilation aborted at C:/Perl/site/lib/Log/Log4perl/Appender.pm line 10.
Compilation failed in require at C:/Perl/site/lib/Log/Log4perl/Logger.pm line 12.
BEGIN failed--compilation aborted at C:/Perl/site/lib/Log/Log4perl/Logger.pm line 12.
Compilation failed in require at C:/Perl/site/lib/Log/Log4perl.pm line 12.
BEGIN failed--compilation aborted at C:/Perl/site/lib/Log/Log4perl.pm line 12.

Can anyone explain to me why is that happend? Where is the error?

Thanks
,
Tibi
Direct Responses: 6056 | Write a response
Posted on Wed Sep 12 10:31:51 2007 by lloy0076 in response to 5910
Re: about Config.pm

Hi There,

It looks like you've overwritten the Config _module_ in your Log4perl distribution. This particular module is actually Perl and is meant to read your own personal configuration.

Here's what I'd do to get back to working with it again:

* reinstall your Log4perl or replace Config.pm with one found via the source browser or your downloaded source

* make a configuration and put it somewhere that you can remember, (eg C:/config.cfg)

* Then:

use Log::Log4perl; Log::Log4perl->init("C:/config.cfg");

DSL
Write a response