Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

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.

share|improve this answer
add comment

You could try to use syslog:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.