ROMANIA_engineer
ROMANIA_engineer

Reputation: 56636

Force Apache to update log files path without restart in WAMP

How can I force Apache (part of WAMP) to write the new logs in the new log files without restarting the server?


In Apache2\conf\httpd.conf I updated the path for ErrorLog and CustomLog directives.

The LogLevel and LogFormat directives were not changed.

After I changed them, I managed (I don't know how - accidentally or it was done automatically, but I am sure that I didn't restart the server explicitly) to get the new logs in the new files. Maybe this didn't happen immediately, because I observed this after 20 minutes (the new log files were created and the new logs went to them, not to the old ones). This is what I wanted to achieve!

But then I changed the paths again:

but the logs didn't go to the new path (they were still written to ../logs/a2.log and ../logs/b2.log).

I was thinking at the following 2 possible approaches that could solve my problem, but probably there is another approach:

  1. Reload the whole httpd.conf without stopping the Apache (or any other component from WAMP).
  2. Force only the ErrorLog and CustomLog lines to be updated (in terms of executing some commands directly in cmd, ignoring the httpd.conf file).

Details:

Upvotes: 4

Views: 2300

Answers (2)

covener
covener

Reputation: 17872

On Windows, apache.exe -k restart is mildly graceful -- in-flight requests have 30 seconds to complete.

Beyond this, you're probably out of luck for a safe way to rename files being written to on Windows. You should never be running a single HTTP server for this very reason. You have no way to do any routine maintenance.

Upvotes: 1

Roy
Roy

Reputation: 41

To answer this question correctly you need to tell me which logging api is being used in your apache configuration.

If using log4j then see the following URL Log4j Automatic Configuration

You will find information here which talks about setting the monitorInterval property, in the Log4j configuration file. Setting this attribute to a non-zero value ( > 5) will result in the file being checked the next time a log event is evaluated and/or logged and the monitorInterval, specified in seconds, has elapsed since the last check

Upvotes: 1

Related Questions