Class TelnetAppender
Appender that allows clients to connect via Telnet to receive log messages
public class TelnetAppender : AppenderSkeleton, IBulkAppender, IAppender, IOptionHandler
- Inheritance
-
TelnetAppender
- Implements
- Inherited Members
Remarks
The TelnetAppender accepts socket connections and streams logging messages back to the client. The output is provided in a telnet-friendly way so that a log can be monitored over a TCP/IP socket. This allows simple remote monitoring of application logging.
The default Port is 23 (the telnet port).
Constructors
TelnetAppender()
Default constructor
public TelnetAppender()
Remarks
Default constructor
Properties
Port
Gets or sets the TCP port number on which this TelnetAppender will listen for connections.
public int Port { get; set; }
Property Value
- int
An integer value in the range MinPort to MaxPort indicating the TCP port number on which this TelnetAppender will listen for connections.
Remarks
The default value is 23 (the telnet port).
Exceptions
- ArgumentOutOfRangeException
The value specified is less than MinPort or greater than MaxPort.
RequiresLayout
This appender requires a log4net.Layout to be set.
protected override bool RequiresLayout { get; }
Property Value
- bool
true
Remarks
This appender requires a log4net.Layout to be set.
Methods
ActivateOptions()
Initialize the appender based on the options set.
public override void ActivateOptions()
Remarks
This is part of the IOptionHandler delayed object activation scheme. The ActivateOptions() method must be called on this object after the configuration properties have been set. Until ActivateOptions() is called this object is in an undefined state and must not be used.
If any of the configuration properties are modified then ActivateOptions() must be called again.
Create the socket handler and wait for connections
Append(LoggingEvent)
Writes the logging event to each connected client.
protected override void Append(LoggingEvent loggingEvent)
Parameters
loggingEventLoggingEventThe event to log.
Remarks
Writes the logging event to each connected client.
OnClose()
Overrides the parent method to close the socket handler
protected override void OnClose()
Remarks
Closes all the outstanding connections.