SafetyRally.Logger
Implementation of wrapper interface.
This logger has methods to allow the caller to log at the following
levels:
-
DEBUG
The and methods log messages
at the DEBUG level. The default value for this level is .
The property tests if this level is enabled for logging but it's
also tested insede this method.
-
INFO
The and methods log messages
at the INFO level. The default value for this level is .
The property tests if this level is enabled for logging but it's
also tested insede this method.
-
WARN
The and methods log messages
at the WARN level. The default value for this level is .
The property tests if this level is enabled for logging but it's
also tested insede this method.
-
ERROR
The and methods log messages
at the ERROR level. The default value for this level is .
The property tests if this level is enabled for logging but its
also tested insede this method.
-
FATAL
The and methods log messages
at the FATAL level. The default value for this level is .
The property tests if this level is enabled for logging but its
also tested insede this method.
The ISRLog interface is use by application to log messages.
Use the to obtain logger instances
that implement this interface. The
or static methods are used to get logger instances.
This class contains methods for logging at different levels and also
has properties for determining if those logging levels are
enabled in the current configuration.
This interface can be implemented in different ways. This documentation
specifies reasonable behavior that a caller can expect from the actual
implementation, however different implementations reserve the right to
do things differently.
Simple example of logging messages
ISRLog log = SRLogManager.GetCommonLogger("application-log");
log.Info("Application Start");
log.Debug("This is a debug message");
Log a message object with the level including
the stack trace of the passed
as a parameter.
The exception to log, including its stack trace.
Log a message object with the level including
the stack trace of the passed
as a parameter.
The exception to log, including its stack trace.
Log a message object with the level including
the stack trace of the passed
as a parameter.
The exception to log, including its stack trace.
Log a message object with the level including
the stack trace of the passed
as a parameter.
The exception to log, including its stack trace.
Log a message object with the level including
the stack trace of the passed
as a parameter.
The exception to log, including its stack trace.
Gets/ Sets if the logger should record the level events.
Initializes a new instance of the class.
Name of the logger.
This class is used by client applications to request logger instances.
This class has static methods that are used by a client to request
a logger instance. The and methods are
used to retrieve a logger.
See the interface for more details.
Simple example of logging messages
ISRLog log = SRLogManager.GetCommonLogger("application-log");
log.Info("Application Start");
log.Debug("This is a debug message");
Initializes all the SRLogManager data.
Builds a xml configuration based in the logger name and config type.
Name of the requested logger.
Configuration type.
XmlElement with the configuration.
Gets a logger with a specified name.
Name of the logger to get.
Type of configuration to use to create the logger.
The requested logger.
Gets a common logger.
The requested common logger.
Gets a device logger with a specified name.
Name of the logger to get.
The requested device logger.
Logger Configuration Type.
Common configuration.
Configuration especific for a device.
Layout that formats the log events as XML elements.
The output of the consists of a series of
log4net:event elements. It does not output a complete well-formed XML
file. The output is designed to be included as an external entity
in a separate file to form a correct XML file.
This approach enforces the independence of the
and the appender where it is embedded.
The version attribute helps components to correctly
interpret output generated by . The value of
this attribute should be "1.2" for release 1.2 and later.
Alternatively the Header and Footer properties can be
configured to output the correct XML header, open tag and close tag.
When setting the Header and Footer properties it is essential
that the underlying data store not be appendable otherwise the data
will become invalid XML.
Writer adapter that ignores Close
Constructs an SRXmlLayout
Constructs an SRXmlLayout.
The LocationInfo option takes a boolean value. By
default, it is set to false which means there will be no location
information output by this layout. If the the option is set to
true, then the file name and line number of the statement
at the origin of the log statement will be output.
If you are embedding this layout within an SmtpAppender
then make sure to set the LocationInfo option of that
appender as well.
Produces a formatted string.
The event being logged.
The TextWriter to write the formatted event to
Format the and write it to the .
This method creates an that writes to the
. The is passed
to the method. Subclasses should override the
method rather than this method.
Does the actual writing of the XML.
The writer to use to output the event to.
The event to write.
Override the base class method
to write the to the .
Gets/Sets a value indicating whether to include the TimeStamp in
the XML events.
true if the TimeStamp should be included in the XML
events; otherwise, false.
If ShowTimeStamp is set to true, then the timestamp of the
event will be output.
Gets/Sets a value indicating whether to include the Level in
the XML events.
true if the Level should be included in the XML
events; otherwise, false.
If ShowLevel is set to true, then the level of the
event will be output.
Gets/Sets a value indicating whether to include the Thread Name in
the XML events.
true if the Thread Name should be included in the XML
events; otherwise, false.
If ShowThread is set to true, then the thread name of the
event will be output.
Gets/Sets a value indicating whether to include the Identity in
the XML events.
true if the Identity should be included in the XML
events; otherwise, false.
If ShowIdentity is set to true, then the identity of the
event will be output.
Gets/Sets a value indicating whether to include the Domain in
the XML events.
true if the Domain should be included in the XML
events; otherwise, false.
If ShowDomain is set to true, then the domain of the
event will be output.
Gets/Sets a value indicating whether to include the UserName in
the XML events.
true if the UserName should be included in the XML
events; otherwise, false.
If ShowUserName is set to true, then the username of the
event will be output.
Gets/Sets a value indicating whether to include the Properties in
the XML events.
true if the Properties should be included in the XML
events; otherwise, false.
If ShowProperties is set to true, then the properties of the
event will be output.
Gets/Sets a value indicating whether to Indent the XML output in
the XML events.
true if identation should be used in the XML
events; otherwise, false.
If IndentXml is set to true, then the output will be indented.