question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Write-Debug not showing up in App Insights/Console Logs

See original GitHub issue

We are trying to use Write-Debug and Write-Verbose for debug messages but none of the messages appear on the console or in App Insights. The host.json is configured as follows:

{
  "version": "2.0",
  "logging": {
    "logLevel": {
      "default": "Trace"
    }
  }
}

The following statements:

Write-Host "Log levels"
Write-Error "This is an error"
Write-Warning "This is a warning"
Write-Information "This is information"
Write-Verbose "This is verbose"
Write-Debug "This is debug"

result in the following logs on the Console and in App Insights:

2019-03-08T15:58:42.324 [Information] INFORMATION: Log levels
2019-03-08T15:58:42.717 [Error] ERROR: This is an error

Microsoft.Azure.WebJobs.Script.Rpc.RpcException : Result: ERROR: This is an error
Exception: This is an error
Stack:
2019-03-08T15:58:42.748 [Warning] WARNING: This is a warning
2019-03-08T15:58:42.748 [Information] INFORMATION: This is information

Do we need to do anything else as configuration or should this be enough to log the messages?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
TylerLeonhardtcommented, Mar 8, 2019

@toddysm can you try something for me?

Can you change your:

Write-Verbose "This is verbose"
Write-Debug "This is debug"

to

Write-Verbose "This is verbose" -Verbose
Write-Debug "This is debug" -Debug

and see if this repros

1reaction
toddysmcommented, Mar 11, 2019

Yes. This works. It sounds redundant though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Application insights for function app not showing console ...
Hello I am writing to figure out why application insights for function apps are not showing any console log statements in the function...
Read more >
With PowerShell, how can I get Write-Debug output to ...
3 Answers. tl;dr: Run $DebugPreference = 'Continue' to start seeing output from Write-Debug calls. To turn on debug output for a given cmdlet ......
Read more >
How To Write Debug Messages To The Console In PowerShell
In this video, Kenward will cover using the Write-Debug cmdlet, the $DebugPreference automatic variable, using debugging in PowerShell ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found