Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Apache httpd be made to log errors to console instead of log files under Windows?

I'm doing infrequent development with Apache/PHP on my Windows machine so I've opted to run apache as a console process instead of a service. It would be nice if errors could be logged to the console window instead of a logfile so I can see them immediately. Can this be done somehow? It doesn't seem that apache has such a capability built in and I can't find a mod that would do this either.

like image 300
Vilx- Avatar asked Apr 27 '10 23:04

Vilx-


3 Answers

Yes it can.

Edit your httpd.conf file to pipe the output of the error log to your console window with this directive:

ErrorLog "|more"
like image 111
serg10 Avatar answered Nov 20 '22 18:11

serg10


Just wanted to update this question with an answer that may be plaguing a bunch of people.

Scenario:

  • Running an apache2 docker container
  • Want output of docker run <container_id> to show logs

Without talking too much about docker, the relevant command I ran to run apache and show logs at the same time:

/usr/sbin/apache2 & tail -f /var/log/apache2/*

You can modify this as you need (I am using debian:jessie image). As mentioned in a comment above, you have get tail for windows and I believe the & operator should work in Windows as well (not sure about this).

This command will block your shell and keep sprouting stuff from your logs...

Hope this helps someone

like image 30
Populus Avatar answered Nov 20 '22 18:11

Populus


I'm not sure if apache will let you do that, but have you tried using:

tail -f /the/apache/logfile.log ?

That should let you watch the log in realtime (assuming you aren't buffering it or anything)

EDIT: Since this is a windows machine, the same thing can be done using TextPad (just have it to auto-reload the log file on change). It will function the same as tail

like image 3
Mitch Dempsey Avatar answered Nov 20 '22 17:11

Mitch Dempsey