search

Home  >  Q&A  >  body text

After apache-nginx log is deleted and a file is re-created, the log cannot be displayed.

There is a web.log file under the project root directory. The file was too big, so I deleted it and re-created an empty .log file. Now there is no log in this new file, and the pictures are of the old file. information

阿神阿神2749 days ago585

reply all(2)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-16 17:02:43

    If you do not stop nginx when you delete the log, nginx still holds the handle of the old file. Although the newly created file has the same name, it is not actually the same file, so it is not written.
    You need to reload nginx at this time

    nginx -s reload

    When clearing the log in the future, do not delete the file directly. Use the command to clear the file

    truncate -s 0 web.log

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-16 17:02:43

    Whether the permissions of the newly created log file are configured correctly and whether write permissions are granted.

    reply
    0
  • Cancelreply