2014-10-06 73 views
1

我想在Perl的幫助下構建應用程序。該應用程序由perl的Thread::PoolLog4Perl包組成。Perl錯誤與Log :: Log4perl :: Appender ::文件

當我排除包Thread::Pool日誌工程。 但是,當我把它給它給了我錯誤如下:

ERROR: can't load appenderclass 'Log::Log4perl::Appender::File' 
Could not find file for 'Log::Log4perl::Appender::File' at C:/Perl/site/lib/load.pm line 214. 

工作代碼:

# use Thread::Pool; 
use Log::Log4perl; 

my $log_conf = 'LoggingConfiguration.conf'; 
Log::Log4perl::init($log_conf); 
my $logger = Log::Log4perl->get_logger(); 
$logger->info(" Info Msg "); 

但如果我刪除評論爲

use Thread::Pool; 

它給上面的錯誤

這發生的確切原因是什麼?如何避免這個錯誤?

+1

*你安裝了* Log :: Log4perl :: Appender :: File嗎? – Biffen 2014-10-06 07:28:52

+1

是的,我沒有線程::池安裝它的工作正常。 – 2014-10-06 07:33:46

回答

4

從一些搜索周圍,似乎有與主題::池的使用use load編譯的問題:

Thread::Pool bug tracker

當創建下的perl 5.8.8對象,增加'使用線程::池'導致問題,當項目 正在祝福。具體來說,在許多情況下,通常返回值的代碼是 ,然後祝福顯示爲空。從Thread :: *中刪除'use load'編譯指示可以解決問題。

Thread::Pool on cpanratings

該模塊的確是方便,但在我看來,有一些嚴重的問題了。 其次,此模塊正在使用導致Log :: Log4perl發生故障的'使用負載'。這當然是一個邪惡的海森堡。只是因爲我在這個源文件中發現了捷克評論(http://w2c.martin.majlis.cz/w2c/doc-gen/crawler_8pl_source.html - 鏈接被破壞),它並沒有花我幾天的時間進行調試。

Thread::Pool issues with Log4Perl on PerlMonks - 沒有得到解決,但答案包括:

不要使用線程池::。它是越野車。切換到Thread::Queue。 (OP的迴應:Thread :: Queue存在問題)

您也可以嘗試Thread::Pool::Simple。我比Thread :: Pool有更好的運氣。

因此,共識是要麼嘗試從Thread :: Pool中刪除use load,要麼使用不同的模塊。

+0

好的謝謝你的幫助 – 2014-10-06 09:33:36