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

Level layout renderer

Rolf Kristensen edited this pageJun 6, 2023 ·14 revisions

Thelog level.

Platforms Supported:All

Configuration Syntax

${level:format=Ordinal}

Alternatively, add padding to align the message.

${pad:padding=5:inner=${level:uppercase=true}}

Alternatively, truncate to align the message:

${level:format=TriLetter:uppercase=true}

Parameters

  • uppercase - Output level in upper-case. Default:false

    Introduced with NLog v5.0 to simplify default Layout, instead of using the ambientuppercase-property

  • format - Output format of the level. Introduced in 4.4.6 Default: Name
    Possible values:

    • Name - Render the standard level name.

      Introduced in NLog 4.4.6

    • FullName - Render the full level name (Expands "Info" and "Warn")

      Introduced in NLog 4.7

    • FirstCharacter - Render the first character of the level.

      Introduced in NLog 4.4.6

    • Ordinal - Render the ordinal (aka number) for the level.

      Introduced in NLog 4.4.6

    • TriLetter - Renders LogLevel as 3 letter abbreviations (Trc, Dbg, Inf, Wrn, Err, Ftl)

      Introduced in NLog 5.0.5

    NameFullNameTriLetterFirstCharacterOrdinal
    TraceTraceTrcT0
    DebugDebugDbgD1
    InfoInformationInfI2
    WarnWarningWrnW3
    ErrorErrorErrE4
    FatalFatalFtlF5
    OffOffOffO6

Examples

Basic

Configuration:

${level}

Code:

logger.Debug("Test Message")

Result:

Debug

Format

Configuration:

${level:format=FirstCharacter}

Code:

logger.Debug("Test Message")

Result:

D

-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