3

I'm using curl to dowload a jar from a TESTDRIVE script and for debugging purposes it helps to log the http headers returned to a log file. But logging them in the working dir (where the script is executed from) is inconvenient (for the user). I was wondering if there was a /logs/log in unix systems where applications could log their stuff.

Console in the mac indeed seems to pickup logs from multiple applications, somehow.

2 Answers 2

6

There's a system log facility: syslog. From a shell script, call the logger command.

logger -p 'user.info' "hello world"

However, this is for system logs, not for logs intended for a particular user. If the logs are intended for the user who's running the application, then a log file is more appropriate (something like ~/.application-name/downloads.log). An alternate approach would be to send a local mail, but that's only for cases where the user must see the logs, not if they're intended for debugging.

Even if system logs are the right place, a full transcript of HTTP headers is too much information. Log one line in the system logs, and put the transcript in a file in an application-specific directory under /var.

0

You could try to use syslog:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .