Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
snakefoot opened this issue May 4, 2023 · 0 comments
Open

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

snakefoot opened this issue May 4, 2023 · 0 comments

Comments

@snakefoot
Copy link
Contributor

snakefoot commented May 4, 2023

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)

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

No branches or pull requests

1 participant