use Log::Log4perl qw(); Log::Log4perl->init("process.conf"); my $log = Log::Log4perl->get_logger(); open APP, "Exception.bat |" or die "File not found\n"; while(){ print; #log->info; } close APP; print "Out of batch file\n";