Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Win32 multiple process and single file redirection

by Frantz (Monk)
on Jan 25, 2005 at 16:39 UTC ( [id://424928]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Win32 multiple process and single file redirection
in thread Win32 multiple process and single file redirection

You can try File::Log

With this package, differents process can log in the same file.

  • t1.pl ( launches t2.pl and t3.pl ) :
    use strict ; use warnings ; use Win32::Process ; use File::Log; my $call_hProcess = "" ; my $call_Resultat = 0 ; $call_Resultat = Win32::Process::Create($call_hProcess, "c:/Perl/bin/Perl.exe", "perl t2.pl", 0, IDLE_PRIORITY_CLASS, "." ) ; $call_Resultat = Win32::Process::Create($call_hProcess, "c:/Perl/bin/Perl.exe", "perl t3.pl", 0, IDLE_PRIORITY_CLASS, "." ) ;
  • Here's t2.pl , t3.pl
    use strict ; use warnings ; use File::Log; # Log INFORMATIONAL or worse to a file my $log = File::Log->new({ debug => 4, logFileName => 'app.log', logFileMode => '>>', dateTimeStamp => 0, stderrRedirect => 0, defaultFile => 1, logFileDateTime => 0, appName => 'MyApp', PIDstamp => 1, storeExpText => 0, }); for ( my $i=0; $i <= 50; $i++ ) { sleep 2 ; $log->msg(4, "t2.pl : $i\n"); }
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Node Status?
    node history
    Node Type: note [id://424928]
    help
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others pondering the Monastery: (4)
    As of 2024-04-23 03:18 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found