Disable apache error. log generation and generate logs by date

Source: Internet
Author: User

How to change Httpd. error. log off, the method is very simple, directly in httpd. in the conf configuration file, locate ErrorLog and add # To the front to restart apache. However, this will bring a lot of problems to your system analyst, for example, apache cannot analyze many error intrusions.

LogLevel is used to adjust the details of information recorded in error logs.

Level Description Example
Emerg emergency-the system is unavailable. "Child cannot open lock file. Exiting"
Alert must take immediate action. "Getpwuid: couldn't determine user name from uid"
Critical Condition of crit. "Socket: Failed to get a socket, exiting child"
Error. "Premature end of script headers"
Warn warning. "Child process 1234 did not exit, sending another SIGHUP"
Notice is generally important. "Httpd: caught SIGBUS, attempting to dump core in ..."
Info. "Server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers )..."
Debug error level information "Opening config file ..."


We recommend that you set crit to warn.


Edit httpd. conf In the conf folder and find the following content:
 
==================================

The Code is as follows: Copy code
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# Alert, emerg.
#
LogLevel warn

==================================
The LogLevel parameter can be viewed above. (See ErrorLog command ).
 
If the default level is warn, logs at or above the warn level will be recorded, resulting in a large number of erro-level error logs that "the file does not exist. We recommend that you use the crit-level settings to record logs with more than the fatal level, effectively reducing the number of logs.

Change LogLevel warn to LogLevel crit and restart apache.

Change the ErrorLog parameter in the Httpd. conf configuration file to the following to generate a log file every day.

The Code is as follows: Copy code

ErrorLog "| bin/rotatelogs.exe-l logs/error-% Y-% m-% d. log 1 M"
ErrorLog "| bin/rotatelogs.exe-l logs/error-% Y-% m-% d. log 86400"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.