ObjectRendererWhen using a Logger in your application, you will notice that all Logger functions accept an Object for their message parameters. This takes advantage of the fact that all classes inherit from System.Object in .NET. Another reason for using an Object is for Log4Net to allow you to pass more than just a string to be logged. Log4Net gains a little code reuse by creating a class called ObjectRenderer. ObjectRenderer is used by the Layout class to transform the LoggingEvent into a string message to be logged. By implementing a custom ObjectRenderer, you can pass a custom Object to Log4Net, and the Layout will call your specified custom ObjectRenderer to get a String representation of the state of the Object. This is demonstrated using a DataSet in the "Examples"section of this chapter. |