Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-153

Make it easier to configure multiple appenders in code using BasicConfigurator

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.2.10
    • 1.2.11
    • None
    • None

    Description

      Users wanting to configure log4net in code using more than just a single appender must cast the repository into a Hierarchy then manually add elements:

      Repository.Hierarchy.Hierarchy hierarchy =
      (Repository.Hierarchy.Hierarchy)LogManager.GetRepository();
      hierarchy.Root.AddAppender(alpha);
      hierarchy.Root.AddAppender(beta);
      hierarchy.Configured = true;

      The BasicConfigurator should make it easier to accomplish this:

      BasicConfigurator.Configure(alpha, beta);

      This can be accomplished by adding an overload to Configure that accepts an params IAppender[]:

      IBasicRepositoryConfigurator.Configure(params IAppender[] appenders)

      Attachments

        Activity

          People

            Unassigned Unassigned
            ron liu ron
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: