Hi All

I am trying to extend log4j to achieve the following.

I need to log custom information, like action, machine origin in a XML
format, as well as all the other standard information that log4j provides.

An example of this in action is

        cat.info ("This is a test", ACTION.test, MACHINE.transmissionEngine1 );

To accomplish this I have written a VineCategory, VineCategoryFactory,
VineLoggingEvent.

To accomplish the XML output, I have written VineInfoLayout and
VineErrorLayout. ( I have different data requirements for reporting errors).

My VineInfoLayout extends layout and I have overwritten the format method.

    // example of format method
  public String format(LoggingEvent event) {
    buf.setLength (0);
    if (event instanceof VineLoggingEvent) {
      VineLoggingEvent vineEvent = (VineLoggingEvent)event;
      buf.append ("<type>"+vineEvent.type+"</type>"); // the rest of code to
follow
    } else {
      buf.append("Not a vineEvent" ); // would like to format the event as
per normal, a pattern layout
    }
    return buf.toString();
  }

I do have some problems and converns. The main one being, if a 'normal' call
to info is made. I would like a seperate patternLayout to be used. So the
problem is, from the format method in my layout class, how do I now call a
different paternLayout (or a different appender?). Which leads to my
concern ---- Am I on the right track? It doesn't seem what I am doing is
simple or neat. (Sorry if it just means I still do not have a proper
understanding of log4j).


Thanks in advance
Jeff Singer


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

Reply via email to