我正在使用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.
我不知道他们为什么要来。我也尝试了各种日志级别,但我仍然得到这些。
答案 0 :(得分:3)
Log::Log4perl
而非Log::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