You can do it with a vbscript custom action (see below). I know these
are frowned upon but for controlled environments they can work ok. I
think this should be part of the iis:WebLog custom action, maybe you
should add a feature request.

Neil



In WiX:

<!-- Custom Action to set WebSite Log Directory Path -->
<CustomAction Id="SetWebLogFolderProperty" Property="SetWebLogFolder"
Value="/SiteName='MyWebSite' /WebLogPath='D:\IISLogs'" />
<CustomAction Id="SetWebLogFolder" BinaryKey="SetWebLogFolder.vbs"
VBScriptCall="SetWebSiteLogFolder" Execute="deferred" Return="check" />
<Binary Id="SetWebLogFolder.vbs" SourceFile="SetWebLogFolder.vbs" />



Save the following as SetWebLogFolder.vbs

---START----------------------------------------------------------------
------
Function SetWebSiteLogFolder

    Dim sSiteName, sWebLogPath

    ' Grab installer properties required for this CA
    ' deferred so must use CustomActionData (/arg='value')
    sCustomData = Session.Property("CustomActionData")
    LogMsg "SetWebSiteLogFolder: CustomActionData = " & sCustomData 
         
    sSiteName = GetPropertyValue(sCustomData, "SiteName") 
    LogMsg "SetWebSiteLogFolder: SiteName = " & sSiteName 
    
    sWebLogPath = GetPropertyValue(sCustomData, "WebLogPath") 
    LogMsg "SetWebSiteLogFolder: WebLogPath = " & sWebLogPath 
    
    If len(sSiteName) = 0 Then
        LogMsg "SetWebSiteLogFolder: ERROR: SiteName value not passed to
Custom Action"
        SetWebSiteLogFolder = -1
        exit function
    end if
    If len(sWebLogPath) = 0 Then
        LogMsg "SetWebSiteLogFolder: ERROR: WebLogPath value not passed
to Custom Action"
        SetWebSiteLogFolder = -1
        exit function
    End If
        
    Dim oWebServer
    Set oWebServer = GetObject("IIS://LocalHost/W3SVC")
    
    Dim oSite
    Set oSite = FindSite(oWebServer, sSiteName)
        
    If oSite Is Nothing Then
        LogMsg "SetWebSiteLogFolder: ERROR: Cannot find web site: " &
sSiteName
        SetWebSiteLogFolder = -1
    Else
        oSite.LogFileDirectory = sWebLogPath
        oSite.SetInfo
        LogMsg "SetWebSiteLogFolder: Log folder for " & sSiteName & " is
" & oSite.LogFileDirectory
        SetWebSiteLogFolder = 0
    End If
    
    Set oSite = Nothing
    Set oWebServer = Nothing

End Function

Function LogMsg(sMsg)
    Dim oRec
    Set oRec = Session.Installer.CreateRecord(1)
    oRec.StringData(0) = sMsg
    LogMsg = Session.Message(&H04000000, oRec)
End Function

Function FindSite(oWebServer, sSiteName)

    Dim oSite
    
    For Each oSite In oWebServer
        If (oSite.Class = "IIsWebServer") Then
            LogMsg("Found Site: " & oSite.ServerComment)
            If (oSite.ServerComment = sSiteName) Then
                Set FindSite = oSite
                Exit Function
            End If
        End If
    Next
    Set FindSite = Nothing

End Function

' Extracts the value from Custom Action based 
' on the format /arg='value'
Function GetPropertyValue(customActionData, valueName)
    
    ' Split the CustomActionData into properties
    properties = Split(customActionData,"/")

    For iProps = lbound(properties) to ubound(properties)
        If Instr(1,properties(iProps),valueName, vbTextCompare) Then
            
            ' Now split on = to get property value pair
            propertyPair = Split(properties(iProps),"=")
            
            ' Remove single quotes from value and return
            Set regEx = New RegExp   
            regEx.Pattern = "^'|'$"
            regEx.Global = True
            
            ' Return value
            GetPropertyValue = regEx.Replace (Trim(propertyPair(1)),"")
            Exit For
            
        End If
    Next

End Function
---END------------------------------------------------------------------
----




-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bjerstedt,
Tony [Audatex - Americas]
Sent: 10 July 2008 17:29
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] How do I configure IIS logging?

I need to control the location where the IIS logs are placed as well as
the contents (operations requires additional fields be included). The
default is to log to a directory under the system folder which is not
acceptable.

 

I see that the WebLog element lets me select the type of log, but
doesn't appear to configure anything else. Is there a way to do this
using standard extensions? 

 

Tony Bjerstedt

Software Engineer

Hollander, a Solera Company

14800 28th Ave N., Suite 190

Plymouth, MN 55447

Direct: (763)519-3235

Email: [EMAIL PROTECTED]

www.hollandersolutions.com <http://www.hollandersolutions.com> 

 

------------------------------------------------------------------------
-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to