MAMP Pro: Generate Separate Apache Virtual Host Access Logs (Per Host Logs)

Discussion for guides including MAMP official & unofficial documentation. User submitted guides can be moved here by moderators.
Post Reply
mampsupportmod
Site Admin
Posts: 156
Joined: Wed Jan 20, 2021 3:06 am

MAMP Pro: Generate Separate Apache Virtual Host Access Logs (Per Host Logs)

Post by mampsupportmod »

In order to create separate Apache access log or error log files per virtual host, you need to create a MAMP Virtual Host Iteration per HTTPD conf file. Follow the steps below.



Create Separate Apache Access Log for MAMP [HTTP] Hosts
1. Go to MAMP Pro -> Edit Template -> Apache-> httpd.conf.

2. In your httpd.conf configuration file, find the line with MAMP_VirtualHost_iteration_begin_MAMP.

3. Now, add a configuration directive for your access log file under the MAMP_VirtualHost_iteration_begin_MAMP. You must name your log file MAMP_VirtualHost_ServerName_MAMP.log In the example below, we use the following CustomLog directive.

Code: Select all

CustomLog "/Applications/MAMP/logs/MAMP_VirtualHost_ServerName_MAMP.log" "%t %v %h %l %u \"%r\" %>s %b \"%{User-Agent}i\""

4. Save and restart Apache.


Create Separate Apache Access Log for MAMP [HTTPS] Hosts
1. Go to MAMP Pro -> Edit Template -> Apache -> httpd-ssl.conf.

2. In your httpd-ssl.conf configuration file, find the line with MAMP_SSLVirtualHost_iteration_begin_MAMP.

3. Now, add a configuration directive for your access log file under the MAMP_SSLVirtualHost_iteration_begin_MAMP. You must name your log file MAMP_SSLVirtualHost_ServerName_MAMP.log In the example below, we use the following CustomLog directive.

Code: Select all

CustomLog "/Applications/MAMP/logs/MAMP_SSLVirtualHost_ServerName_MAMP.log" "%t %v %h %l %u \"%r\" %>s %b \"%{User-Agent}i\""
4. Save and restart Apache.
MAMP Support Forums is an unofficial support forum covering MAMP & MAMP Pro solution stacks.
Post Reply