Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

LoggerFactory does not work while using SpannerMigrationCommandExecutor

Open
#6 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp, google-cloud
Domain
databases

Research direction

Start by tracing SpannerMigrationCommandExecutor and its service-collection registration, then compare logging behavior with that registration removed. Reproduce the sample configuration and verify that the configured LoggerFactory receives log messages while the executor remains registered.

Written by the indexing model from the issue text.

Description

known limitation priority: p3 type: bug

(Copied from other repository)

Here is sample of my log provider:

    public class MyLoggerProvider : ILoggerProvider
    {
        public ILogger CreateLogger(string categoryName)
        {
            return new MyLogger();
        }

        public void Dispose()
        { }

        private class MyLogger : ILogger
        {
            public bool IsEnabled(LogLevel logLevel)
            {
                return true;
            }

            public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
            {
                File.AppendAllText(@"C:\temp\log.txt", formatter(state, exception));
                Console.WriteLine(formatter(state, exception));
            }

            public IDisposable BeginScope<TState>(TState state)
            {
                return null;
            }
        }
    }

Configure logger:

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                optionsBuilder.UseSpanner("Data Source=projects/appdev-soda-spanner-staging/instances/orm-test-instance/databases/test_migration_db_4");
            }

            var lf = new LoggerFactory();
            lf.AddProvider(new MyLoggerProvider());
            optionsBuilder.UseLoggerFactory(lf);
        }

In case of removing SpannerMigrationCommandExecutor from service collection it loges as expected.

Dominant language
C#
Stars
34
Forks
13
Avg merge
1d 10h
Merged PRs (30d)
19

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from googleapis/dotnet-spanner-entity-framework

All issues in googleapis/dotnet-spanner-entity-framework

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.