From: Nan C. <cui...@gm...> - 2011-04-14 02:20:40
|
Hi Gurus, I'm trying to get help from you as I'm facing a problem while trying to use the DBIAppender in multithreading code. When my code tried to create new threads, the logger in the sub-thread body threw out exception like this: thread failed to start: DBD::Oracle::db prepare failed: handle 2 is owned by thread 83e0008 not current thread 8973c18 (handles can't be shared between threads and your driver may need a CLONE method added) at /usr/cisco/packages/perl/perl-5.8.8/lib/site_perl/5.8.8/Log/Log4perl/Appender/DBI.pm line 88. I'm new to Perl. I heard of that DBI is thread-safe and this might be the root cause of this problem. But while accpting this, I still need a solution to make the logger work also in sub-threads. I tried to share the logger, but it came out with another error saying "(in cleanup) Can't call method "FIRSTKEY" on an undefined value at ..... /Log/Log4perl/Logger.pm line 90 during global destruction.". And one fellow told me try to create new DBI connection while in new thread, but I have no idea of how to do it. Since you guys are the source, I'm turning to you. Can you guys show me a way to my destination? Would appreciate that. Thanks & Regards, NC |