Why Apache2 does not write logs?

9,308

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.

Share:
9,308

Related videos on Youtube

Vladimir Vukanac
Author by

Vladimir Vukanac

think, plan, test, code, integrate, deploy, play.

Updated on September 18, 2022

Comments

  • Vladimir Vukanac
    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
      Jos almost 8 years
      It has, in my experience, always been in /var/log/apache2.
    • Vladimir Vukanac
      Vladimir Vukanac almost 8 years
      Yes, 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
    Vladimir Vukanac almost 8 years
    I 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
    Lupen almost 8 years
    You'd need to source the /etc/apache2/envvars in order to set the environment variables.