Skip to content

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

@snakefoot

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)

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