Class XmlHierarchyConfigurator
- Namespace
- log4net.Repository.Hierarchy
- Assembly
- log4net.dll
Initializes the log4net environment using an XML DOM.
public class XmlHierarchyConfigurator
- Inheritance
-
XmlHierarchyConfigurator
- Inherited Members
Remarks
Configures a Hierarchy using an XML DOM.
Constructors
XmlHierarchyConfigurator(Hierarchy)
Construct the configurator for a hierarchy
public XmlHierarchyConfigurator(Hierarchy hierarchy)
Parameters
hierarchyHierarchyThe hierarchy to build.
Remarks
Initializes a new instance of the XmlHierarchyConfigurator class with the specified Hierarchy.
Methods
Configure(XmlElement)
Configure the hierarchy by parsing a DOM tree of XML elements.
public void Configure(XmlElement element)
Parameters
elementXmlElementThe root element to parse.
Remarks
Configure the hierarchy by parsing a DOM tree of XML elements.
ConvertStringTo(Type, string)
Converts a string value to a target type.
protected object ConvertStringTo(Type type, string value)
Parameters
typeTypeThe type of object to convert the string to.
valuestringThe string value to use as the value of the object.
Returns
- object
An object of type
typewith valuevalueornullwhen the conversion could not be performed.
CreateObjectFromXml(XmlElement, Type, Type)
Creates an object as specified in XML.
protected object CreateObjectFromXml(XmlElement element, Type defaultTargetType, Type typeConstraint)
Parameters
elementXmlElementThe XML element that contains the definition of the object.
defaultTargetTypeTypeThe object type to use if not explicitly specified.
typeConstraintTypeThe type that the returned object must be or must inherit from.
Returns
- object
The object or
null
Remarks
Parse an XML element and create an object instance based on the configuration data.
The type of the instance may be specified in the XML. If not
specified then the defaultTargetType is used
as the type. However the type is specified it must support the
typeConstraint type.
FindAppenderByReference(XmlElement)
Parse appenders by IDREF.
protected IAppender FindAppenderByReference(XmlElement appenderRef)
Parameters
appenderRefXmlElementThe appender ref element.
Returns
- IAppender
The instance of the appender that the ref refers to.
Remarks
Parse an XML element that represents an appender and return the appender.
ParseAppender(XmlElement)
Parses an appender element.
protected IAppender ParseAppender(XmlElement appenderElement)
Parameters
appenderElementXmlElementThe appender element.
Returns
- IAppender
The appender instance or
nullwhen parsing failed.
Remarks
Parse an XML element that represents an appender and return the appender instance.
ParseChildrenOfLoggerElement(XmlElement, Logger, bool)
Parses the children of a logger element.
protected void ParseChildrenOfLoggerElement(XmlElement catElement, Logger log, bool isRoot)
Parameters
catElementXmlElementThe category element.
logLoggerThe logger instance.
isRootboolFlag to indicate if the logger is the root logger.
Remarks
Parse the child elements of a <logger> element.
ParseLevel(XmlElement, Logger, bool)
Parses a level element.
protected void ParseLevel(XmlElement element, Logger log, bool isRoot)
Parameters
elementXmlElementThe level element.
logLoggerThe logger object to set the level on.
isRootboolFlag to indicate if the logger is the root logger.
Remarks
Parse an XML element that represents a level.
ParseLogger(XmlElement)
Parses a logger element.
protected void ParseLogger(XmlElement loggerElement)
Parameters
loggerElementXmlElementThe logger element.
Remarks
Parse an XML element that represents a logger.
ParseRenderer(XmlElement)
Parses an object renderer.
protected void ParseRenderer(XmlElement element)
Parameters
elementXmlElementThe renderer element.
Remarks
Parse an XML element that represents a renderer.
ParseRoot(XmlElement)
Parses the root logger element.
protected void ParseRoot(XmlElement rootElement)
Parameters
rootElementXmlElementThe root element.
Remarks
Parse an XML element that represents the root logger.
SetParameter(XmlElement, object)
Sets a parameter on an object.
protected void SetParameter(XmlElement element, object target)
Parameters
elementXmlElementThe parameter element.
targetobjectThe object to set the parameter on.
Remarks
The parameter name must correspond to a writable property
on the object. The value of the parameter is a string,
therefore this function will attempt to set a string
property first. If unable to set a string property it
will inspect the property and its argument type. It will
attempt to call a static method called Parse on the
type of the property. This method will take a single
string argument and return a value that can be used to
set the property.