Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Need to capture Log of each thread --Parallel::ForkManager;

Thread Tools

Need to capture Log of each thread --Parallel::ForkManager;

Posts: n/a
Hi All,
In one of my application,i am cloning a process to 4 different
threads,using Parallel::ForkManager module.
Can anyone tell me how can i track each thread ,and is it possible to
create separate log files for each thread.

My Program is something like this....

my $child_proc_mgr=new Parallel::ForkManager($maxprocesses);
for(my $i = $from; $i <=$to; $i++)
{ my $sourcefname=$tmpfname;
my $targetfname=$targetdir;
$sourcefname .= "/".sprintf('%03s',$i);
$targetfname .= "/".sprintf('%03s',$i).".gz";
next if (-e "$targetfname");
next if (-e "$sourcefname.sorting");
next if (-e "$sourcefname.sorted");
$child_proc_mgr->start and next;
my ($src,$sorting,$sorted);
die "\nFile $sourcefname does not exists" if (! -e
open ($src,"< $sourcefname") || die "\nCannot open
$sourcefname for reading $!";
open ($sorting,"> $sourcefname.sorting") ||
die "\nCannot open temp file $sourcefname.sorting for
writing $!";
close $src;
close $sorting;
print "\nSorting file $sourcefname";
sort_file("$sourcefname.sorting","$sourcefname.sor ted");
my $sortstatus= $? >> 8;
if ($sortstatus != 0)
{ unlink $targetfname;
die "\n $sourcefname.sorting -- Sort was failed $!";
print "Sorting successful for file
$sourcefname.sorting to $sourcefname.sorted";

Right now proper logging is not happening,many of the print statements
i have given are not getting captured for each thred.
Any pointers to this will be highly appreciated.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
On my web site need the capability to log in as administrator and for others to log in anonymously AAaron123 ASP .Net 1 10-14-2008 08:14 PM
multithreading with each thread in a separate class instance vs. in aC-style kernel thread calls in C++ ssylee C++ 2 01-28-2008 09:39 AM
how do i? Full scan of each control in each grid row cell John Blair ASP .Net 1 08-03-2005 11:02 AM
xsl:for-each for each 3 elements problem Tjerk Wolterink XML 3 11-03-2004 05:22 PM
Need help on the Permissions needed to log to Event Log from ASP.NET? Henrik_the_boss ASP .Net 0 11-05-2003 10:14 AM