srikrishnan has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, I have converted my perl script to exe file using "PAR". Now I want to store the warnings and error messages in a log file while running my exe each time. Because I am not able to see why my exe is not working properly, whereas my perl works correctly. Can anyone help me? Regards, Srikrishnan

Replies are listed 'Best First'.
Re: warnings and error messages in a log
by BioLion (Curate) on Jun 23, 2009 at 10:12 UTC

    Check out :
    http://search.cpan.org/~autrijus/PAR-0.85_01/script/pp
    And the option:
    -L, --log=FILE Log the output of packaging to a file rather than to stdout.

    Or if you need to use STDOUT for something else (doesn't sound like it), you can make your own logfile and redirect warnigns/errors to it

    # make sure errors are put into the logfile # i.e. print STDERR "weird" ~ not in logfile # warn "freaky" ~ in logfile (and the screen) # die "AAaaarrrrrgh!" ~ in logfile $SIG{__WARN__} = sub {print $log_file @_;print STDOUT @_}; $SIG{__DIE__} = sub {print $log_file @_;print STDOUT @_;exit 1};

    Or use Log4Perl or Log::Handler to more or less the same effect.
    Hope this helps.

    Just a something something...
      Thanks for your help Thanks, Srikrishnan
Re: warnings and error messages in a log
by SuicideJunkie (Vicar) on Jun 23, 2009 at 14:13 UTC
    Could you simply run your exe from the command line? (Use a command prompt that won't disappear as soon as the program finishes so that you have time to read the messages)
      Yes I have tried it. When I run exe in dos prompt. No messages are printed in the screen. Thanks, Srikrishnan