Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm running a local web (development) server on my mac with apache installed.

I'm sure it depends on my apache config but basically I just want to run tail -f /var/log/httpd-error.log in a terminal so I can see the error and warnings that occur during the development of my websites.

So my question is where or how do I find where this log file is placed since it is not placed in /var/log/

share|improve this question

5 Answers 5

up vote 18 down vote accepted

As morth pointed out, for the default Mac OS X Apache installation these are located in: /var/log/apache2/error_log.

The location can be changed in the httpd config using the ErrorLog directive, even for individual virtual hosts. Also note that if you installed another Apache besides the built-in one (like through MacPorts, or MAMP), this probably is different for you too. In that case you should have a look at the httpd.conf or equivalent for your installation.

tip: If you have Growl installed, also have a look at this 'growltail' script. I think it's great to get notified of errors while developing, without having the need to switch back to the Terminal all the time.

share|improve this answer
1  
Doesn't lion use apache2 and not apache in /var/log to contain the web server logs? Also, the Console app in /Applications/Utilities is the "Cocoa" log viewer, but it's not as handy as tail for most developers other than to explore the contents of /var/log or peek at multiple logs for short durations. –  bmike Feb 20 '12 at 15:01

The Error Log is located at: /var/log/apache2/error.log

This is for Lion...

share|improve this answer

Is /private/var/log/apache2/error_log what you are looking for?

share|improve this answer
#/usr/sbin/httpd -V
Server version: Apache/2.2.24 (Unix)
Server built:   Aug 24 2013 21:10:43
Server's Module Magic Number: 20051115:31
Server loaded:  APR 1.4.5, APR-Util 1.3.12
Compiled using: APR 1.4.5, APR-Util 1.3.12
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_FLOCK_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/usr"
 -D SUEXEC_BIN="/usr/bin/suexec"
 -D DEFAULT_PIDLOG="/private/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/private/var/run/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"

#find / -name error_log
share|improve this answer

It's normally /var/log/apache2/error_log but...

Note that there's certain types of errors which can occur before apache starts logging, which might lead you to believe that you're looking in the wrong place. If you seem to be having trouble starting apache, and it's not logging any new errors, try doing:

sudo bash -x /usr/sbin/apachectl -k start

or try

sudo apachectl -e debug

or bypass the apachectl script and try just

sudo httpd -k start
share|improve this answer

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.