cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How to get curl to send only errors to a file

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 27 Jan 2005 08:38:36 +0100 (CET)

On Wed, 26 Jan 2005, Scott Haneda wrote:

> What I want to do, is schedule a cron job to log that error, no matter what
> I try to get that error sent to file, I can not, for example:
> curl "https://secure1.authorize.net/" > log.txt
> When curl works, I get data in the file, when curl errors (6) I get a empty
> file.

In plain unix-style, you do it like this:

  curl [URL] 2>errorfile

With curl, you also have the option --stderr that sends errors to a given
file (in case your shell or OS don't provide a working 2-solution):

  curl [URL] --stderr errorfile

I hope this helps.

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2005-01-27