Doorgaan naar de website
OCLC Support

Rotating ezproxy.log on Windows

This document exists for historic reference.

LogFile directive

Please refer to the LogFile directive for the preferred way to implement EZproxy log file rotation.

Historic way to implement log rotation

The balance of this technote appears for historic reference.

Here is a sample batch file to rotate the ezproxy.log file with versions of EZproxy 2.2 and later running on Windows:

c:
cd \ezproxy
set currentdate=%date:~10,4%%date:~4,2%%date:~7,2%
set fn=ezproxy-%currentdate%.log
set tn=ezproxy-%currentdate%.tmp
if exist %tn% del %tn%
ezproxy log %tn%
type %tn% >>%fn%
del %tn%
exit

If you save this script under a name such as c:\ezproxy\rotate.bat, then you can configure Windows to run it on a regular basis using the at command. Sample usage might include:

at 1:00 /every:1 c:\ezproxy\rotate.bat
at 1:00 /every:su c:\ezproxy\rotate.bat
at 1:00 /every:m,t,w,th,f,s,su c:\ezproxy\rotate.bat

Each of these lines demonstrate rotating the ezproxy.log file at 1 am, with the first rotating on the first of every month, the second on every Sunday morning, and the third on every day of the week.