IIS:在哪里可以找到 IIS 日志?

发布于 2024-11-16 06:15:34 字数 142 浏览 3 评论 0原文

我正在尝试设置第三方应用程序,这需要在我的本地 IIS 中托管支持网站。我已经完全按照安装指南中的说明创建了一个网站,但遇到了一些问题,并且想查看 IIS 日志的内容。令人尴尬的是,问题是我找不到日志文件!

所以我的问题是:IIS7默认将日志存储在哪里?

I'm trying to set up an application from a third party, which requires a supporting website hosted in my local IIS. I've created a website exactly as explained in their install guide, but am having some problems, and would like to see what the IIS log has to say. Embarrassingly enough, the problem is I can't find the log files!

So my question is: Where does IIS7 store logs by default?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

下壹個目標 2024-11-23 06:15:34

我认为访问日志的默认位置是

%SystemDrive%\inetpub\logs\LogFiles

否则,请在 IIS 管理器下检查,在左侧窗格中选择计算机,然后在中间窗格中转到 IIS 区域中的“日志记录”下。在那里您将设置所有站点的默认位置(但是这在所有站点上都是可覆盖的)

您还可以查看

%SystemDrive%\Windows\System32\LogFiles\HTTPERR

哪个将包含仅代表错误的类似日志文件。

I think the default place for access logs is

%SystemDrive%\inetpub\logs\LogFiles

Otherwise, check under IIS Manager, select the computer on the left pane, and in the middle pane, go under "Logging" in the IIS area. There you will se the default location for all sites (this is however overridable on all sites)

You could also look into

%SystemDrive%\Windows\System32\LogFiles\HTTPERR

Which will contain similar log files that only represents errors.

悟红尘 2024-11-23 06:15:34

我相信这是了解 IIS 日志位置的更简单方法,而不仅仅是假设默认位置:

转到您的 IIS 站点,例如“默认”,单击它,如果启用了日志记录,您应该在右侧看到“日志记录” :

在此处输入图像描述< /a>

打开它,你应该看到文件夹就在那里:

输入图像描述这里

不客气!

I believe this is an easier way of knowing where your IIS logs are, rather than just assuming a default location:

Go to your IIS site, e.g. Default, click on it, and you should see "Logging" to the right if logging is enabled:

enter image description here

Open it and you should see the folder right there:

enter image description here

You are welcome!

山有枢 2024-11-23 06:15:34

我添加这个答案是因为在研究了网络之后,我最终得到了这个答案,但仍然不知道要查看 IIS 日志文件夹的哪个子文件夹

如果您的服务器有多个网站,您需要知道该站点的 IIS ID。在 IIS 中获取此信息的一个简单方法是单击左侧面板中的 Sites 文件夹。每个站点的 ID 显示在右侧面板中。

知道 ID 后,我们将其称为n,相应的日志位于 IIS 日志文件夹的 W3SVCn 子文件夹中。因此,如果您的网站 ID 为 4,并且 IIS 日志位于默认位置,则日志位于此文件夹中:

%SystemDrive%\inetpub\logs\LogFiles\W3SVC4

致谢:

  • @jishi 的回答告诉您默认情况下日志的位置。
  • @Rafid 的回答解释了如何找到实际位置(可能不是默认位置)。
  • @Bergius 的回答提供了一种编程方式来查找特定网站的日志文件夹位置,同时考虑 ID,而无需使用 IIS。

I'm adding this answer because after researching the web, I ended up at this answer but still didn't know which subfolder of the IIS logs folder to look in.

If your server has multiple websites, you will need to know the IIS ID for the site. An easy way to get this in IIS is to simply click on the Sites folder in the left panel. The ID for each site is shown in the right panel.

Once you know the ID, let's call it n, the corresponding logs are in the W3SVCn subfolder of the IIS logs folder. So, if your website ID is 4, say, and the IIS logs are in the default location, then the logs are in this folder:

%SystemDrive%\inetpub\logs\LogFiles\W3SVC4

Acknowlegements:

  • Answer by @jishi tells where the logs are by default.
  • Answer by @Rafid explains how to find actual location (maybe not default).
  • Answer by @Bergius gives a programmatic way to find the log folder location for a specific website, taking ID into account, without using IIS.
蓝海 2024-11-23 06:15:34

日志文件默认位置的 100% 正确答案是...

%SystemDrive%\inetpub\logs\LogFiles

是的,您可以将其输入到资源管理器地址栏中,它会起作用。

为了 100% 确定,您需要查看 IIS 中网站的日志记录。

https ://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-85/enhanced-logging-for-iis85

  1. 打开 IIS 管理器。
  2. 在“连接”窗格中选择站点或服务器,
  3. 双击“日志记录”。
  4. 站点日志文件的位置可以在目录字段中找到

编辑: 正如 Andy 在下面的评论中指出的,您需要确保在安装 IIS 时选择启用 HTTP 日志记录,否则 HTTP日志记录将不可用。

启用 HTTP 日志记录

The 100% correct answer for the default location of the log files is...

%SystemDrive%\inetpub\logs\LogFiles

Yes you can enter this into the explorer address bar it'll work.

To be 100% sure, you need to look at the logging for the web site in IIS.

https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-85/enhanced-logging-for-iis85

i.e.

  1. Open IIS Manager.
  2. Select the site or server in the Connections pane,
  3. Double-click Logging.
  4. The location of log files for the site can be found within the Directory field

EDIT: As pointed out by Andy in the comments below you need to ensure when installing IIS that you elected to enable HTTP logging, otherwise HTTP logging won't be available.

Enable HTTP Logging

悟红尘 2024-11-23 06:15:34

一种更简单的方法是使用 PowerShell,如下所示:

Get-Website yoursite | % { Join-Path ($_.logFile.Directory -replace '%SystemDrive%', $env:SystemDrive) "W3SVC$($_.id)" }

或者只是

Get-Website yoursite | % { $_.logFile.Directory, $_.id }

如果您只需要自己的信息并且不介意在大脑中解析结果:)。

对于奖励积分,请附加 | ii 到要在资源管理器中打开的第一个命令,或 | gci 列出文件夹的内容。

A much easier way to do this is using PowerShell, like so:

Get-Website yoursite | % { Join-Path ($_.logFile.Directory -replace '%SystemDrive%', $env:SystemDrive) "W3SVC$($_.id)" }

or simply

Get-Website yoursite | % { $_.logFile.Directory, $_.id }

if you just need the info for yourself and don't mind parsing the result in your brain :).

For bonus points, append | ii to the first command to open in Explorer, or | gci to list the contents of the folder.

网白 2024-11-23 06:15:34

尝试查看Windows事件日志,可能会有一些有用的信息

Try the Windows event log, there can be some useful information

上课铃就是安魂曲 2024-11-23 06:15:34

启用跟踪可能是 Windows 事件日志的更好替代方案。这为我提供了修复我自己的 WebService 所需的信息。

Enabling Tracing may be a better alternative to the Windows Event Log. This gave me the information I needed to fix my own WebService.

蛮可爱 2024-11-23 06:15:34

我认为 IIS 日志记录的默认位置是:c:\inetpub\wwwroot\log\w3svc

I think the Default place for IIS logging is: c:\inetpub\wwwroot\log\w3svc

财迷小姐 2024-11-23 06:15:34

我在以下位置找到了 IIS 日志文件。

C:\inetpub\logs\LogFiles\

这有助于解决我的问题。

I have found the IIS Log files at the following location.

C:\inetpub\logs\LogFiles\

which help to fix my issue.

抱着落日 2024-11-23 06:15:34

C:\inetpub\logs\LogFiles

检查站点身份及高级设置

C:\inetpub\logs\LogFiles

Check the identity of the site going to sites and advanced settings

如梦亦如幻 2024-11-23 06:15:34

最简单的答案是这样查询:

(Get-Website * | % { $_.logFile.Directory});ls $GetIISLogs\W3SVC1\*

如果您有多个网站,您将得到多个答案,因此您需要使用“foreach”进行查询以获取带有目录的网站名称...

The simplest answer is to query like this:

(Get-Website * | % { $_.logFile.Directory});ls $GetIISLogs\W3SVC1\*

If you have more than one site you will get more than one answer, so you need to query with a 'foreach' to get the website name with the directory...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文