In the bin
of Apache folder there is rotatelogs
This program is useful for generating rotating logs.
Apache rotatelogs
Here is an example of how to generate 1 log file per day:
<IfModule log_config_module>
LogFormat "%h %l %u %{%Y-%m-%d %H:%M:%S}t \"%r\" %>s %b \"%{Referer}i\"" combined
CustomLog "|bin/rotatelogs.exe C:/www/site/logs/access/log_access-%Y-%m-%d.txt 86400 +000" combined env=!dontlog
</IfModule>
Comments:
1. Even under Windows environment, the path should use normal bar.
2. The rotatelogs path must be relative, in Windows environment, and should start with the |
vertical bar.
C:/www/site/...
Do do not backslash:
C:\www\site\...
The logs will be generated according to the format log_access-%Y-%m-%d.txt
log_access-2016-08-29.txt
log_access-2016-08-30.txt
log_access-2016-08-31.txt
Can also restrict by file size. For example, generate a new log file every 1mb. See the options in the documentation: link
If you just want to disable:
#CustomLog "|bin/rotat...
A simple sharp (#) deactivates the line.
About us
Note: Normally in a development environment there is not much reason to save access logs using the Apache logging capabilities.
The most interesting thing might be to save error logs. For this it follows the same form. Just apply it to the ErrorLog
parameter.
ErrorLog "|bin/rotatelogs.exe C:/www/site/logs/errors/log_error-%Y-%m-%d.txt 86400 +000"
The same applies to the Linux environment. Just modify the rotatelog path
Windows: |bin/rotatelogs.exe
Linux: bin/rotatelogs
For more functionality, I recommend that you organize each project into an independent virtualhost instead of organizing them into a single virtualhost separated by folders.