0

我正在使用 Log4Perl 模块进行日志记录。当我运行应用程序时,我在控制台上获得了一些 Log4Perl 模块日志:

Subroutine import redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 76.
Subroutine initialized redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 214.
Subroutine new redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 220.
Subroutine reset redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 227.
Subroutine init_once redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 234.
Subroutine init redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 241.
Subroutine init_and_watch redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 255.
Subroutine easy_init redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 270.
Subroutine wrapper_register redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 348.
Subroutine get_logger redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 356.
Subroutine caller_depth_offset redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 398.
Subroutine appenders redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 418.
Subroutine add_appender redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 424.
Subroutine appender_thresholds_adjust redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 439.
Subroutine appender_by_name redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 484.
Subroutine eradicate_appender redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 502.
Subroutine infiltrate_lwp redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 510.
Subroutine easy_closure_create redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 531.
Subroutine easy_closure_cleanup redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 545.
Subroutine easy_closure_category_cleanup redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 562.
Subroutine easy_closure_global_cleanup redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 578.
Subroutine easy_closure_logger_remove redefined at C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 587.
Subroutine remove_logger redefined at      C:/Strawberry/perl/site/lib/LOG/Log4perl.pm line 602.

我不知道他们为什么来。我也尝试了各种日志级别,但我仍然得到这些。

4

1 回答 1

3

Log::Log4perl不是Log::Log4Perl。_

来自 Log4perl 常见问题

如果您在 Windows 上并收到警告消息,例如

常量子例程 Log::Log4perl::_INTERNAL_DEBUG 在 C:/Programme/Perl/lib/constant.pm 第 103 行重新定义。子例程导入在 C:/Programme/Perl/site/lib/Log/Log4Perl.pm 第 69 行重新定义。子例程在 C:/Programme/Perl/site/lib/Log/Log4Perl.pm 第 207 行重新定义初始化。

那么很有可能您使用的是'Log::Log4Perl'(错误的大写P)而不是正确的'Log::Log4perl'。Windows 上的 Perl 不能很好地处理这个错误,并且会吐出大量令人困惑的警告消息。但是现在您知道了,只需使用正确的模块名称就可以了。

另请查看此 rt:https ://rt.cpan.org/Public/Bug/Display.html?id=23890

于 2015-08-07T10:37:01.300 回答