HttpResponse.AppendToLog(String) HttpResponse.AppendToLog(String) HttpResponse.AppendToLog(String) HttpResponse.AppendToLog(String) Method


将自定义日志信息添加到 Internet Information Services (IIS)日志文件。Adds custom log information to the Internet Information Services (IIS) log file.

 void AppendToLog(System::String ^ param);
public void AppendToLog (string param);
member this.AppendToLog : string -> unit
Public Sub AppendToLog (param As String)


String String String String

要添加到日志文件的文本。The text to add to the log file.


下面的示例演示如何将字符串追加到日志中。The following example shows how to append a string to the log.

Response.AppendToLog("Page delivered");
Response.AppendToLog("Page delivered")


若要允许在日志文件中记录指定的字符串,首先必须为要在 IIS 中记录其活动的站点启用 "扩展日志记录属性" 对话框的 " URI 查询" 选项。To allow for the specified string to be recorded in the log file, you first must enable the URI Query option of the Extended Logging Properties dialog box for the site that you want to log activity for in IIS.

若要在 IIS 6.0 中自定义扩展日志记录,请执行以下步骤:To customize extended logging in IIS 6.0, follow these steps:

  1. 在 IIS 管理器中,展开 "本地计算机" 节点,展开 "Web" 或 "FTP 站点" 文件夹,右键单击 Web 或 FTP 站点,然后单击 "属性"。In IIS Manager, expand the local computer node, expand the Web or FTP Sites folder, right-click the Web or FTP site, and then click Properties.

  2. 单击 " Web" 或 "FTP 站点" 选项卡,然后选中 "启用日志记录" 复选框(如果尚未选择)。Click the Web or FTP Site tab, and then select the Enable logging check box (if it is not already selected).

  3. 在 "活动日志格式" 框中,单击 " W3C 扩展日志文件格式"。In the Active log format box, click W3C Extended Log File Format.

  4. 单击属性Click Properties.

  5. 单击 "高级" 选项卡,选择要记录的属性,然后单击 "确定"Click the Advanced tab, select the properties that you want to log, and then click OK.