Where does IIS 7.5 log errors?
Asked Answered
W

5

37

Where does IIS 7.5 log errors?

Event Viewer? Log File?

I get a very nonspecific internal 500 error. I would like to find out more.

I'm running PHP and I did what this last comment on this post said. But still it is not logging to the C:\windows\temp folder.

Whitaker answered 21/1, 2011 at 21:58 Comment(2)
This should probably be tagged with "iis" as well. See e.g. Should I not use the generic tag if my solution is limited to a specific version?.Hideout
This may be quite different on Windows compared to Linux, but for locating the PHP error log, the canonical is Where does PHP store the error log? (PHP 5, Apache, FastCGI, and cPanel) (despite the over-specific title). Some of the general methods described there also work on Windows.Hideout
L
37

To report errors in Event Viewer, go to your php.ini file and make sure logging is on.

log_errors = On

Then enable error_log to write to syslog (with is Event Viewer on a Windows machines)

error_log = syslog
Leoleod answered 21/1, 2011 at 22:24 Comment(5)
I'm wondering why this would be useful..wouldn't it be interspersed with lots of other OS/app logs?Canaliculus
@SandipGangakhedkar - It's user preference. I personally like having a separate log file. But some people use network monitoring tools and they only look at Event Viewers or SysLogs.Leoleod
You also need to ensure error_reporting and log_errors_max_len are properly set. E.g. error_reporting=-1, log_errors_max_len=0.Chaudfroid
@NeerPatel, How can we set it to server log not syslog (event viewer)? By server log, I mean whatever setting IIS is currently set to.Chaudfroid
@Chaudfroid - By Server Log, do you mean text file? If so, Do this : error_log = C:\TEMP\PHP.LOGLeoleod
A
20

For PHP v5.3, look here:

C:\Windows\Temp\PHP53_errors.log
Appoggiatura answered 16/12, 2014 at 3:18 Comment(0)
A
12

On my IIS 7.5 server I found this code in the php.ini file right down the bottom.

[WebPIChanges]
error_log=C:\Windows\temp\php54_errors.log
upload_tmp_dir=C:\Windows\temp
session.save_path=C:\Windows\temp
cgi.force_redirect=0
cgi.fix_pathinfo=1
fastcgi.impersonate=1
fastcgi.logging=0
max_execution_time=300
date.timezone=Australia/Canberra
extension_dir="C:\Program Files (x86)\PHP\v5.4\ext\"

I'm not sure if all of the above code is required because I'm not great with php.ini files but I can confirm the error log file is reachable and working.

This fix still requires the following if anyone is wondering.

log_errors = on
error_log = syslog
Allover answered 5/6, 2014 at 0:18 Comment(0)
C
9

I once had a problem where the error log wasn't writeable by the PHP interpreter. I added the IUSR user to the file's security permissions (right-click the file, properties, security tab) with read write and modify permissions and was then able to see PHP errors in the log file.

Chemise answered 22/4, 2013 at 1:50 Comment(1)
I tested it to work with II_IUSRS on windows server 2012. IUSR doesn't work for some reason.Chaudfroid
S
4

There should be a "Logging" icon on the site setup in IIS.

If you haven't changed the directory for that it looks like it defaults to %SystemDrive%\inetpub\logs\LogFiles

Look in your settings and I'd also recommend creating a logs folder above your site files to keep your logs separated.

Soothfast answered 21/1, 2011 at 22:2 Comment(2)
Those are access logs. I'm looking for error logs. But thanks anyway.Whitaker
Or systemroot\System32\LogFiles\HTTPERRFroghopper

© 2022 - 2024 — McMap. All rights reserved.