Log4j's ability to log any object relies on only one premise: any java object can be transformed into a String. The Object class contains a toString method and every java object is an instance of the Object class. However, the toString() method does not always yield the desired results, which is where ObjectRenderers come into play.
The code that selects the appropriate ObjectRenderer for a given object (to be logged) relies on two Java primitives. First, the code must be able to determine the class of the object being rendered. Second, it must be able to walk the class hierarchy of the object in question, including interfaces as well as super-classes. The rest is pretty straight forward.
I have not coded in C++ for along time so I can't remember whether any of the above is available in C++.
At 06:46 PM 8/27/2004, Jack Strohm wrote:
I was wondering if there has been any thought to the ability to log a binary stream of data? With log4j you can log any object, but log4cxx only handles strings (in both properties and the message). Thank for any input you can give me as to how difficult this might be if I wanted to do this myself.
- jack
-- Ceki G�lc�
For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
