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.

Expose WebJob Context Information To Custom TraceWriters

See original GitHub issue

In an attempt to make reviewing/querying WebJob logs easier, I took advantage of the JobHostConfiguration.Tracing.Tracers collection and added a custom SqlTraceWriter to my WebJob project (sample code here).

This works pretty well but can get somewhat confusing due to WebJobs being executed in parallel.

Would it be possible to expose some of the WebJob Context information to the TraceWriter?

Either via a static class or by passing it into the TraceWriter.Trace() method perhaps?

The various *InstanceIds could be added to the SQL Table to help identify logs from the same job.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
brettsamcommented, Oct 6, 2016

TraceEvent.Properties will now include function information – available properties found here: https://github.com/Azure/azure-webjobs-sdk/blob/master/src/Microsoft.Azure.WebJobs.Host/Loggers/TraceEventExtensions.cs

0reactions
mathewccommented, Oct 11, 2016

@brettsam can get it up on our myget feed for you to access. We won’t be doing nuget.org update for a while.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Retrieving information about the currently running function
Function context information is exposed by the $TriggerMetadata variable in the run.ps1 file. This variable contains the function name, ...
Read more >
How to use the WebJobs SDK - Azure App Service
Learn more about how to write code for the WebJobs SDK. Create event-driven background processing jobs that access data in Azure and ...
Read more >
FunctionInvokerBase.CreateUserTraceWriter(TraceWriter ...
WebJobs.Script.Description.FunctionInvokerBase.CreateUserTraceWriter in the Microsoft.Azure.WebJobs.Script.Description namespace.
Read more >
Azure Functions The Journey - Azure App Service
In Chris's //build talk Introducing Azure Functions he explained how Azure Functions is built on the Azure WebJobs SDK. The WebJobs SDK has ......
Read more >
suppress logging in azure webjobs ("executing: &#39
If that isn't what you want, you could register your own custom TraceWriter via the JobHostConfiguration.Tracing.Tracers collection. If you then replaced your ...
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