logging errors using perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting logging errors using perl
# 1  
Old 04-10-2011
logging errors using perl

Hi,

Can some one please tell me how to redirect only errors to the log file using perl.

Thanks,
Anjan.

---------- Post updated at 08:41 PM ---------- Previous update was at 08:39 PM ----------

Also, i dont want to use any module. Please tell me in normal way
# 2  
Old 04-11-2011
You can capture all the error using below code. It will log all the error in the file test,txt.
Code:
open STDERR, ">test.txt" or die "Can't open file for STDERR";

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Errors running perl statement

When I run this #!/bin/bash Block count: 421958912 Reserved block count: 4219589 perl -e "printf(\"%.1lf%%\n\", ($Reserved block count * 100.0 ) / $Block count);" I get these error messages. Can someone please help me? andyk_~/Downloads$ Show_Percent_Reserved_Blocks.sh... (4 Replies)
Discussion started by: drew77
4 Replies

2. Programming

Please help me understand errors in perl program

co #! /usr/bin/perl use strict; use warnings; use diagnostics; my $amount=""; my $bain; ; my $code=""; my $date;my $day;my $line; my $mo; my $LNUM = 0; my $xyz=""; my $yr; $yr = 2015; my $F; my @F; while (<>) { chop; ++$LNUM; @F = split(';'); if ( $F eq "Date" )... (1 Reply)
Discussion started by: hpk
1 Replies

3. Shell Programming and Scripting

Expect/tcl (not perl) logging troubles

My logs aren't correct. Im trying to log failure and successes, then use the resulting successes file "seed" to perform another function. Problem is that the log has only a single random entry. Thanks in advance for the help ! !#/usr/bin/expect set count 0 set bcount 0 set fcnb 923... (0 Replies)
Discussion started by: sumguy
0 Replies

4. Programming

Errors in Perl when using awk command

Hi Guys, Hope everyone is fine :) I have this code below: #!/usr/bin/perl $num_of_files=`ls | grep -v remover | wc -l`; $remover=`ls -lrt | grep -v total | grep -v remover | head -1 | awk '{print $8}' | rm \`xargs\``; if ($num_of_files>3) { system ($remover); } When I... (3 Replies)
Discussion started by: rymnd_12345
3 Replies

5. Shell Programming and Scripting

Logging perl and shell debug mode.

I have a shell program which calls a perl program. I am running the shell program with command; $ ksh -x <prog_name> Inside the shell program, I am calling perl with warnings. I want to capture the entire output as it comes on screen. The command I tried is: $ ksh -x... (1 Reply)
Discussion started by: som.nitk
1 Replies

6. Shell Programming and Scripting

Perl: Backtick Errors

When trying to use backticks for system commands, is there a way to read the error messages if a command doesn't execute properly? I have no problem getting the results if the command is properly executed. Ex. my @result = `dir`; foreach my $line (@result) { print "Result = $line";... (2 Replies)
Discussion started by: kooshi
2 Replies

7. Shell Programming and Scripting

PERL Syntax Errors

Hi, I am a newbie to PERL and working on a script. When running it I get a lot of compilation errors. The actual command in the program (which is within a case structure) is given below # This gives the actual count of inquires from a log file (It works fine when I type this on the... (2 Replies)
Discussion started by: nurani
2 Replies

8. Shell Programming and Scripting

perl version for syntax errors

All, Does it matter what perl verios your running when you get syntax errors? on version 5.6.1 the code works fine, but on 5.8.0 the code gets errors? #!/usr/bin/perl #use strict; #use warnings; my $mess = 'messages'; my $mess1 = 'messages.1'; my $mess2 = 'messages.2'; my... (13 Replies)
Discussion started by: bigben1220
13 Replies

9. Solaris

logging errors

The errors are coming up on my display and screwing up the console windows that I am trying to work from. They take up about half the screen. Anyone know how I can stop them? Also, one of the errors is a sendmail noqueu syserr anyone seen it? (4 Replies)
Discussion started by: calamine
4 Replies
Login or Register to Ask a Question