0

Currently, I have a project which is using Azure Function with .net core 3.1 and I would like to know how to trace every method called for example:

    [FunctionName("Count")]
    public static async Task<IActionResult> Run(
        [HttpTrigger(AuthorizationLevel.Function, "get", Route = "Count")] HttpRequest req,
        ILogger log)
    {
        int cnt = selectCount("Select * from A");
    }
    
    public static int selectCount(string str)
    {
        return 2;
    }

And it will record to Azure Log Analytics workspace without Log.Information("Function:Count Start"); and Log.Information("selectCount Start");

Log message Sample as below

_________________________________________________
|      TimeGenerated     |        Message       | 
|2020/11/17 09:00:00.000 | Function:Count Start | 
|2020/11/17 09:00:00.002 | selectCount Start    | 
|2020/11/17 09:00:00.003 | selectCount end      | 
|2020/11/17 09:00:00.001 | Function:Count end   | 
_________________________________________________
Jay Fang
  • 1
  • 1
  • I don't fully understand what you're trying to achieve. The sql statement you're passing into `selectCount` is never executed, why is that? – Casper Dijkstra Nov 17 '20 at 09:58

1 Answers1

0

I realize this is not the answer you are looking for, however you cannot achieve such logging without explicitly enabling that in your code.

To what purpose do you not want to have those lines in your code?

MMThornberg
  • 344
  • 1
  • 5