How do I increase the logging level for the deployment log?

Rupert's Avatar

Rupert

28 Dec, 2013 12:00 PM

Hi,

My deployment script isn't deploying to my web server but the deployment actually succeeds. I want to find out what is going wrong - but the deployment log only seems to be logging the most basic information - how do I increase the logging level of the deployment log to include the Write-Verbose messages?

Thanks

  1. Support Staff 1 Posted by Feodor Fitsner on 28 Dec, 2013 05:06 PM

    Feodor Fitsner's Avatar

    Hi Rupert,

    To enable verbose logging I would do an additional "wrapping" deploy-verbose.ps1 script that looks like below:

    # call deploy.ps1 in the same directory with -verbose switch
    $scriptsPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
    . (Join-Path $scriptsPath "deploy.ps1") -Verbose
    

    To make -verbose switch work deploy.ps1 script must have [CmdletBinding()], so minimal script could look like this:

    [CmdletBinding()] # this line is important to make -verbose work
    Param(
        # parameters go here
    )
    
    Write-Host "I'm a regular message"
    Write-Verbose "I'm a verbose message"
    

    From AppVeyor you call deploy-verbose.ps1 then. If you use any of AppVeyor system parameters like -projectName do not forget to declare them in deploy-verbose.ps1 and then pass to deploy.ps1.

    Let me know if it works for you.

  2. 2 Posted by Rupert on 08 Jan, 2014 10:38 AM

    Rupert's Avatar

    Do I need to do more than add [CmdletBinding()] to deploy.ps1 to print messages with Write-Verbose?

    Do I need some sort of if statement? Sorry I am a bit lost.

    Thanks

  3. Support Staff 3 Posted by Feodor Fitsner on 08 Jan, 2014 05:35 PM

    Feodor Fitsner's Avatar

    Well, yes, adding [CmdletBinding()] and param() to deploy.ps1 will allow you to call it from deploy-verbose.ps1 with -verbose flag.

    Do you have any issues with this method?

    As for me, I usually prefer old-school way of adding additional Write-Host statements across the script :)

  4. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:37 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac