Skip to content

Verify Target-Ref working with SplitGroup with AppSettings.json #667

Description

@snakefoot

Could be nice if one could do this:

{
  "NLog": {
    "throwConfigExceptions": true,
    "targets": {
      "logconsole": {
        "type": "Console"
      },
      "email": {
        "type": "mail"
      },
      "bothTargets": {
        "type": "SplitGroup",
        "targets": {
            "logconsole": null,
            "email": null
        }
      }
    },
    "rules": [
      {
        "logger": "*",
        "minLevel": "Info",
        "writeTo": "bothTargets"
      }
    ]
  }
}

Maybe one will get "cheated" by the automatic sorting of dictionary-items, so the splitgroup must be named so it comes "last", after the other target-names to ensure they have been parsed/declared.

Similar to this:

<targets>  
   <target name='email' xsi:type='mail' />
   <target name='logconsole' xsi:type='console' />

   <target name="bothTargets" xsi:type="SplitGroup">
        <target-ref name="logconsole" />
        <target-ref name="email" />
   </target>
</targets>

See also: #568 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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