Hello Roger Wagy
Thanks for reaching out on Microsoft Q&A and really appreciate your patience while we looked into this.
Understand from description that you're running into .NET 8 Durable Functions activity logger issue.
Steps:
1.Use FunctionContext.GetLogger()
[Function("CustCreate_1")]
public async Task<Customer_SQL> CustCreate_1(
[ActivityTrigger] Customer_Json.Rootobject c,
FunctionContext context)
{
var logger = context.GetLogger("CustCreate_1");
logger.LogInformation("Activity started");
return new Customer_SQL();
}
- FunctionContext is automatically supplied by the runtime.
- Logger obtained this way is replay-safe.
- Do not pass ILogger as a parameter.
Microsoft Learn – Logging in isolated process functions
2.Use Constructor Dependency Injection
public class MyActivities
{
private readonly ILogger<MyActivities> _logger;
public MyActivities(ILogger<MyActivities> logger)
{
_logger = logger;
}
[Function("CustCreate_1")]
public async Task<Customer_SQL> CustCreate_1([ActivityTrigger] Customer_Json.Rootobject c)
{
_logger.LogInformation("Activity started");
return new Customer_SQL();
}
}
- ILogger is injected via DI.
- Works correctly with replay scenarios.
Microsoft Learn – Dependency injection in isolated process
1.Do not pass non-serializable types (ILogger, HttpContext, CancellationToken) as activity function parameters.
2.Use only serializable POCOs, strings, primitives as activity inputs.
If issue persists, please provide the below information via private message:
- Durable Functions version
- Full activity function code
- How orchestrator calls the activity
- Any custom serialization or middleware
Kindly let us know if the above helps or you need further assistance on this issue.
Please Accept the Answer if the information helped you. This will help us and others in the community as well.
Thanks
Thanks