Ads by Lake Quincy Media

Wiki Navigation

 
Gibraltar - Learn about the best analysis tool for NLog

Network target

NLog documentation is currently being re-organized to use the wiki format. Some content is still missing or incomplete.
We need volunteers to help maintain and organize this Wiki. Please contact Jarek if you are interested in helping out.

Sends log messages over the network. 

Supported in

Configuration Syntax

<targets>
  <target xsi:type="Network"
          name="String"
          onOverflow="Enum"
          newLine="Boolean"
          layout="Layout"
          maxMessageSize="Integer"
          encoding="Encoding"
          connectionCacheSize="Integer"
          keepConnection="Boolean"
          address="Layout" />
</targets>
Read more about using the Configuration File.

Parameters

  • General Options
  • name - Name of the target.
  • Layout Options
  • onOverflow - Action that should be taken if the message is larger than maxMessageSize.
    Possible values:
    • Discard - Discard the entire message.
    • Error - Report an error.
    • Split - Split the message into smaller pieces.
  • newLine - Indicates whether to append newline at the end of log message.Boolean Default: False
  • layout - Layout used to format log messages.Layout Required. Default: ${longdate}|${level:uppercase=true}|${logger}|${message}
  • maxMessageSize - Maximum message size in bytes.Integer Default: 65000
  • encoding - Encoding to be used.Encoding Default: utf-8
  • Connection Options
  • connectionCacheSize - Size of the connection cache (number of connections which are kept alive).Integer Default: 5
    This parameter is not supported in:
    • NLog v1.0 for .NET Compact Framework 1.0
    • NLog v1.0 for .NET Compact Framework 2.0
    • NLog v1.0 for .NET Framework 1.0
    • NLog v1.0 for .NET Framework 1.1
    • NLog v1.0 for .NET Framework 2.0
  • keepConnection - Indicates whether to keep connection open whenever possible.Boolean Default: True
  • address - Network address.Layout
    The network address can be:
    • tcp://host:port - TCP (auto select IPv4/IPv6)
    • tcp4://host:port - force TCP/IPv4
    • tcp6://host:port - force TCP/IPv6
    • udp://host:port - UDP (auto select IPv4/IPv6, not supported on Silverlight)
    • udp4://host:port - force UDP/IPv4 (not supported on Silverlight)
    • udp6://host:port - force UDP/IPv6 (not supported on Silverlight)
    For HTTP Support use WebService target.
Ads by Lake Quincy Media