Why Apache2 does not write logs?
On a default Ubuntu installation, the Apache configuration file, /etc/apache2/apache2.conf
contains the following line to ensure that log files are written by default.
ErrorLog ${APACHE_LOG_DIR}/error.log
The APACHE_LOG_DIR
environment variable is set when the Apache service startup script run the shell commands in /etc/apache2/envvars
, which include this variable assignment:
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
Unless you’re running multiple instances of Apache, SUFFIX
will be an empty string so the log file directory is, by default, configured to be/var/log/apache2
.
Related videos on Youtube
Vladimir Vukanac
think, plan, test, code, integrate, deploy, play.
Updated on September 18, 2022Comments
-
Vladimir Vukanac over 1 year
Because I cannot find where Apache saves log files I tried even to reinstall LAMP, but no luck.
Ubunty 14.04, Apache 2.4, php 7.0.4, mysql 5.(5)
If I ssh to server, should I be able to get a path of this?:
$ echo $APACHE_LOG_PATH
I am getting a blank line!
-
Jos almost 8 yearsIt has, in my experience, always been in
/var/log/apache2
. -
Vladimir Vukanac almost 8 yearsYes, I thought it also, but got file not exists response. As it seams, even above echo $APACHE_LOG_PATH does not return anything logs are save but guarded inside folder you mention. I see now log files. Thank you!
-
-
Vladimir Vukanac almost 8 yearsI read about all that last night, and that is all OK. I am still confused why echo APACHE_LOG_DIR is not giving enything?
-
Lupen almost 8 yearsYou'd need to source the
/etc/apache2/envvars
in order to set the environment variables.