Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

MySqlConnector.Logging.Microsoft.Extensions.Logging is not prefixing the category name like other loggers #1080

Copy link
Copy link
Closed
@KirillBorunov

Description

@KirillBorunov
Issue body actions

Software versions
MySqlConnector.Logging.Microsoft.Extensions.Logging version: 2.0.0

Describe the bug
The mentioned package is not prefixing the log categories.
So I see categories like "ConnectionPool" instead of "MySqlConnector.ConnectionPool".
Because of this, collisions are possible and I cannot filter all the MySqlConnector logs with single filter, need to know each possible category.

Here is the missing prefix:

public IMySqlConnectorLogger CreateLogger(string name) => new MicrosoftExtensionsLoggingLogger(m_loggerFactory.CreateLogger(name));

The other logging packages DO prefix:

public IMySqlConnectorLogger CreateLogger(string name) => new Log4netLogger(LogManager.GetLogger(s_loggerAssembly, "MySqlConnector." + name));

public SerilogLogger(string name) => m_logger = Serilog.Log.ForContext("SourceContext", "MySqlConnector." + name);

public IMySqlConnectorLogger CreateLogger(string name) => new NLogLogger(LogManager.GetLogger("MySqlConnector." + name));

Exception
Not applicable.

Code sample

LoggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(cfg => 
    cfg.AddConsole()
    .SetMinimumLevel(LogLevel.Debug)
    .AddFilter("ConnectionPool", LogLevel.Information) //How can I filter all MySqlConnector logs? How I can know all posible categories?
);

MySqlConnectorLogManager.Provider = new MicrosoftExtensionsLoggingLoggerProvider(LoggerFactory);

Expected behavior
I expect a prefix "MySqlConnector." just like on the other loggers.

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.