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.
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"
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
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
For windows you can use httpd.exe -X
-X Run httpd in debug mode. Only one worker will be started and the server will not detach from the console.
精彩评论