Skip to content

Logging Migration Status Verification: Ticket #2 (Bulk Migration) Not Implemented#177

Draft
Copilot wants to merge 20 commits intomasterfrom
copilot/migrate-log-debug-to-logger
Draft

Logging Migration Status Verification: Ticket #2 (Bulk Migration) Not Implemented#177
Copilot wants to merge 20 commits intomasterfrom
copilot/migrate-log-debug-to-logger

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

  • Convert UserControlBCISignalCheck.cs to use Microsoft.Extensions.Logging
    • Add using statement for Microsoft.Extensions.Logging
    • Add ILogger field
    • Initialize logger in constructor using ACATLogManager.CreateLogger
    • Replace 34 Log method calls with ILogger methods
      • Log.Debug → _logger.LogDebug
      • Log.Error → _logger.LogError
      • Log.Exception → _logger.LogError(ex, ex.Message)
Original prompt

This section details on the original issue you should resolve

<issue_title>[2] AI-Assisted Log.Debug() to ILogger Migration</issue_title>
<issue_description>Estimate: 2 days
Sprint: Week 1
Assignee: [Developer]


Description

Use AI to find and replace all Log.Debug() calls with modern ILogger<T> pattern across the entire codebase. This is the bulk conversion work.

Context

  • Files affected: 951 C# files
  • Occurrences: ~3,891 Log.Debug/Error/Info calls
  • Pattern: Convert static Log calls to injected ILogger

AI Prompt

Analyze the ACAT codebase and perform the following conversions:

1. For each class that uses Log.Debug(), Log.Error(), Log.Info(), or Log.Verbose():
   a. Add constructor parameter: ILogger<ClassName> logger
   b. Store in private readonly field: private readonly ILogger<ClassName> _logger;
   c. Replace Log.Debug(msg) with _logger.LogDebug(msg)
   d. Replace Log.Error(msg) with _logger.LogError(msg)
   e. Replace Log.Info(msg) with _logger.LogInformation(msg)
   f. Replace Log.Verbose(msg) with _logger.LogTrace(msg)
   g. Replace Log.Exception(ex) with _logger.LogError(ex, ex.Message)

2. Convert string concatenation to structured logging:
   BEFORE: Log.Debug("Value: " + value + " count: " + count)
   AFTER:  _logger.LogDebug("Value: {Value} count: {Count}", value, count)

3. Handle CallerMemberName attributes:
   BEFORE: Log.Debug(msg, [CallerMemberName] string member = "")
   AFTER:  _logger.LogDebug("{Member}: {Message}", member, msg)

4. Generate report showing:
   - Files modified count
   - Replacements made count
   - Classes needing constructor updates
   - Any edge cases requiring manual review

Start with a single file as example, show the changes, then apply pattern to all files.

Manual Tasks

  • Review AI-generated changes (estimate: 4 hours)
  • Fix edge cases AI identified (estimate: 4 hours)
  • Update classes that can't use constructor injection (static classes, etc.)
  • Verify no Log.cs calls remain (use search)
  • Run build and fix any compilation errors
  • Spot-check 10-20 files for quality

Acceptance Criteria

  • ✅ All Log.Debug() calls replaced with _logger.LogDebug()
  • ✅ All Log.Error() calls replaced with _logger.LogError()
  • ✅ All classes using logging have ILogger<T> injected
  • ✅ String concatenation replaced with structured logging placeholders
  • ✅ Solution builds without errors
  • ✅ Zero occurrences of Log.Debug( in codebase (verified by search)
  • ✅ AI-generated report reviewed and documented

Example Conversion

// BEFORE
public class ActuatorManager
{
    public void Start()
    {
        Log.Debug("Starting actuator manager with " + _actuators.Count + " actuators");
        try
        {
            StartInternal();
            Log.Info("Actuator manager started successfully");
        }
        catch (Exception ex)
        {
            Log.Exception(ex);
        }
    }
}

// AFTER
public class ActuatorManager
{
    private readonly ILogger<ActuatorManager> _logger;
    
    public ActuatorManager(ILogger<ActuatorManager> logger)
    {
        _logger = logger;
    }
    
    public void Start()
    {
        _logger.LogDebug("Starting actuator manager with {ActuatorCount} actuators", _actuators.Count);
        try
        {
            StartInternal();
            _logger.LogInformation("Actuator manager started successfully");
        }
        catch (Exception ex)
        {
            _logger.LogError(ex, "Failed to start actuator manager");
        }
    }
}

Validation Script

# Search for remaining old Log calls
grep -r "Log\.Debug\(" --include="*.cs" | wc -l
grep -r "Log\.Error\(" --include="*.cs" | wc -l
grep -r "Log\.Info\(" --include="*.cs" | wc -l

# Should all return 0

Dependencies

Notes

  • Keep old Log.cs file temporarily for reference
  • Mark with [Obsolete] attribute initially
  • Full removal in Week 2 after validation

🎫 Ticket #3: Update Application Entry Points with Logging DI

Labels: phase-1-foundation, logging, P1-High, setup
Estimate: 1 day
Assignee: [Developer]
Sprint: Week 1

Description

Update all application entry points (Program.cs, WinForms startup) to configure dependency injection and logging services. This makes ILogger available throughout the application.

Context

  • ACAT has multiple entry points (ACAT.exe, ACATWatch.exe, etc.)
  • Need to set up DI container at startup
  • Configure logging before any other services

Tasks

  • Identify all Program.cs/Main() entry points
  • Create ServiceConfiguration.cs helper class
  • Update each Program.cs to configure DI
  • Register logging services
  • Update forms to receive ILogger from ...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Migrate Log.Debug() calls to ILogger pattern Logging Migration Status Verification: Ticket #2 (Bulk Migration) Not Implemented Feb 6, 2026
Copilot AI requested a review from michaelbeale-IL February 6, 2026 21:58
@michaelbeale-IL
Copy link
Contributor

@copilot Take a look at the start on the changes and finish the refactoring..

Copilot AI and others added 18 commits February 7, 2026 01:08
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
- Added using Microsoft.Extensions.Logging
- Added ILogger<AnimationPlayer> field
- Initialized logger using LoggingConfiguration.CreateLogger<AnimationPlayer>()
- Converted 107 Log method calls:
  * 100 Log.Verbose → _logger.LogTrace
  * 7 Log.Exception → _logger.LogError
  * 5 Log.Audit left unchanged (not part of logging migration)

Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
- Added using Microsoft.Extensions.Logging
- Added static ILogger<AgentManager> field
- Added SetLogger method for initialization
- Converted 79 Log calls:
  - 51 Log.Debug → _logger?.LogDebug
  - 22 Log.Verbose → _logger?.LogTrace
  - 5 Log.Exception → _logger?.LogError
  - 1 Log.Warn → _logger?.LogWarning

Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
- Changed empty string LogTrace calls to use method names
- Makes logs more informative and useful for debugging

Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
- Replaced all Log.Debug() calls with _logger?.LogDebug()
- Replaced all Log.Error() calls with _logger?.LogError()
- Replaced all Log.Warn() calls with _logger?.LogWarning()
- Replaced all Log.Exception() calls with _logger?.LogError(ex, ...)
- Replaced all Log.Verbose() calls with _logger?.LogTrace()
- Replaced all Log.IsNull() calls with _logger?.LogDebug() with null check logic
- Logger field and constructor injection were already in place
- Converted 68 logging calls total

Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Co-authored-by: michaelbeale-IL <63321611+michaelbeale-IL@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2] AI-Assisted Log.Debug() to ILogger Migration

2 participants