views:

22

answers:

2

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.

+1  A: 

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

webdestroya
It's a windows machine, I already stated that. But I suppose `tail` can be compiled for that too. Well, it's an option, although I'd prefer if there was just one console window. Hmm... then again I could probably get away with setting it up as a service and then creating a batch file to start it, followed by `tail` and then stopping the service. Or just write my own starter/reader/stopper program in C#, that's easy. Still - maybe a more elegant solution is available?
Vilx-
I like this suggestion that way you have the errors in a file and displaying on the console. But yes, tail is native to *nix not Windows, though it can be made to work in Windows, easiest solution I know is cygwin
Flash84x
Wow I totally glanced over the Windows part :(. I updated my answer to use TextPad, which should work
webdestroya
@Flash84x - Actually a quick google search reveals quite a few native Win32 implementation of tail, including some by Microsoft itself. Cygwin is a bit extreme for my taste. :P
Vilx-
@webdestroya - Interesting idea. I'm using Notepad++ myself, but that has this feature too.
Vilx-
@Vilx - I generally found it as an annoyance, but it does have its uses.
webdestroya
@webdestroya - as long as it can be set not to explicitly prompt every time there's an update, it should be fine. I might try it. :)
Vilx-
@Vilx - "Prefs->File-> 'When files are open by another process... 'auto-reload'"
webdestroya
A: 

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"
serg10