True, however since we will be primarily logging to a remote log4j server
and we need to send about 15 fields of data and save each field in a
database table, it would be ideal to send a HashMap or something filled with
these fields. Other wise it gets ugly having to create a method in an
extended Category class like Cat.info(field1, field2, field3, field4,
field5, etc..) to log all 15 fields everytime they need to log. I've already
thought about the ObjectRenderers, but because we are logging remotely, i'd
lose the structure of the object due to the actual message object stored in
the LoggingEvent not being serialized.

I guess the only way I can see doing what I want is to do it the ugly way
and extend the Category class, create a new event object, and place all the
fields in that event object one by one.


For example I wanted to do the following:

        // Client side
        Map headers = new HashMap();
        headers.put("servername", name);
        headers.put("date", date);
        headers.put("referrer", ref);
        headers.put("message", "Page Hit Occurred");
        etc...


        Category cat = Category.getInstance("pagehit");
        cat.info(headers); <== Sends the object over the wire as a seriablized map


        // Server Side (remote)
        Would receive the logging Event from the wire, deserialize it, and pull the
fields out and use the JDBCAppender to put the fields
        into the database one by one.



- Tim


-----Original Message-----
From: Sam Newman [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 26, 2001 4:15 AM
To: LOG4J Users Mailing List
Subject: Re: Design: How to do the following with Log4j


Surely though you are only sending the string representation if you actually
make your message a string? You can send any object you like as the message,
e.g. cat.warn(new Integer()) or whatever. You then use the ObjectRenderers
to convert this to a string representation. I could easily see you sending
your own object and writing a renderer to convert this to a string....

sam
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, July 25, 2001 9:22 PM
Subject: RE: Design: How to do the following with Log4j


>
> Yes I have looked into those..however, it appears that when I want to log
> to a remote server, I will be sending the string representation down the
> wire, which I'd have to then parse into an object on the log server so I
> can access the individual fields. It would be much more useful to send the
> object down the wire so we can then work on the message object whether it
> was local or remote.
>
> - Tim
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to