Skip to content

Behaviour when logging null arguments #365

@jpmnteiro

Description

@jpmnteiro

When logging in 2.1.0, if the argument supplied to the logger is null, the message still gets logged/printed and the argument's place is empty.

However, in 3.0.0, the same situation results in the message being discard/not logged.

Code used to test the behaviour:

            Logger logger = LogManager.GetCurrentClassLogger();
            SimpleConfigurator.ConfigureForConsoleLogging();

            string t = null;
            logger.Info("Hello World.");
            logger.Info("Testing null: {0}", t);

Results in 2.1.0:
2014-06-13 10:33:28.4856|INFO|Snippets.TestNlog|Hello World.
2014-06-13 10:33:28.5586|INFO|Snippets.TestNlog|Testing null:

Results in 3.0.0:
2014-06-13 10:35:08.2735|INFO|Snippets.TestNlog|Hello World.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions