Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow injecting custom logger #422

Closed
AdityaSantoso opened this issue Feb 21, 2022 · 3 comments
Closed

Allow injecting custom logger #422

AdityaSantoso opened this issue Feb 21, 2022 · 3 comments
Assignees
Labels
feature status-triage Issue is under initial triage

Comments

@AdityaSantoso
Copy link

AdityaSantoso commented Feb 21, 2022

Issue description

In a typical .NET application, the logger are injected via ILogger<> interface. This allows us to use other logging framework such as Serilog if needed be. Currently, the logging implementation in SFLoggerFactory instantiates the Log4Net implementation in-line as static singleton.

    public static SFLogger GetLogger<T>()
    {
      if (!SFLoggerFactory.isLoggerEnabled)
        return (SFLogger) new SFLoggerEmptyImpl();
      return SFLoggerFactory.logger == null ? (SFLogger) new Log4NetImpl(LogManager.GetLogger(typeof (T))) : SFLoggerFactory.logger;
    }

Configuration

Driver version: 2.0.8

Dotnet framework and version: .NET 6

Expectation

Allow injecting custom implementation of SFLogger independent from Log4Net so it can play nicely with logging framework that is configured in the rest of the application

@cpb089
Copy link

cpb089 commented Apr 6, 2022

@AdityaSantoso as a quick workaround until this is fixed you can use an appender https://github.com/joelweiss/Log4net.Appender.Serilog

@sfc-gh-jfan sfc-gh-jfan reopened this Jul 1, 2022
@github-actions github-actions bot closed this as completed Jul 2, 2022
@sfc-gh-jfan sfc-gh-jfan reopened this Jul 6, 2022
@xhua026
Copy link

xhua026 commented Feb 14, 2023

hey guys, any updates on this topic?

@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this Jun 7, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka added the status-triage Issue is under initial triage label Jun 7, 2023
@sfc-gh-dszmolka
Copy link
Contributor

looks to be duplicate of #204

@sfc-gh-dszmolka sfc-gh-dszmolka closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature status-triage Issue is under initial triage
Projects
None yet
Development

No branches or pull requests

6 participants