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

Cached Layout Renderer

Rolf Kristensen edited this pageSep 26, 2019 ·12 revisions

Applies caching to another layout output.

Platforms Supported:All

Configuration Syntax

${cached:cached=Boolean:clearCache=ClearCacheOption:inner=Layout:cacheKey=Layout}

or by using ambient property to modify output of other layout renderer:

${other:cached=Boolean}

Parameters

Caching Options

  • cached - Indicates whether this CachedLayoutRendererWrapper is enabled. Boolean Default: True
  • clearCache - Indicates when the cache is cleared. Possible options:None, OnInit, Onclose. ClearCacheOption Default:OnInit, OnClose.

    Introduced in NLog 4.2.

  • cacheKey - the layout to be checked if the cache is still valid. For example, the current day. Default:null.

    Introduced in NLog 4.3.9

  • cachedSeconds - Cached value will expire after timeout. Default: infinite

    Introduced in NLog 4.6.8

Transformation Options

  • inner - Wrapped layout. Layout

Examples

  • ${cached:cached=true:clearCache=OnInit,OnClose:inner=l}: The value ofl is cached and the cache will be cleared when the layout renderer is initialized or when it is closed. This is the same as${cached:cached=true:inner=l}.
  • ${cached:cached=true:clearCache=None:inner=l}: The value ofl is cached and the cache will not be cleared.
  • filename="${cached:cached=true:Inner=${date:format=yyyy-MM-dd hh.mm.ss}:CacheKey=${shortdate}}.log" - Use the first logtime and day in the file name, only one file per day.

Remarks

The value of the inner layout will be rendered only once and reused subsequently.

-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-2026 Movatter.jp