Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/NLogPublic
Rolf Kristensen edited this pageJun 30, 2024 ·9 revisions

A specialized layout that renders to JSON-Array. See alsoJsonLayout

Platforms Supported:All

Introduced with NLog 5.0

<targetname="jsonFile"xsi:type="File"fileName="log-file.json" >      <layoutxsi:type="JsonArrayLayout">            <itemtype='SimpleLayout'text='${date:format=o}' />            <itemtype='SimpleLayout'text='${level}' />            <itemtype='SimpleLayout'text='${message}' />       </layout></target>

Example output:

["2010-01-01T12:34:56Z","Info","hello world" ]

Parameters

  • Items
    • type - Required. The type ofLayout (Ex.SimpleLayout,JsonLayout, etc.)
  • suppressSpaces - Enable to suppress extra spaces in the output JSON. Default:false.
  • renderEmptyObject - When no array-items, then it should still render empty array-value[]. Default:true.

-Troubleshooting Guide - See available NLog Targets and Layouts:https://nlog-project.org/config

Configuration

Programmatic Configuration

Advanced

Extending NLog

Clone this wiki locally


[8]ページ先頭

©2009-2025 Movatter.jp