You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Peter Donald <do...@apache.org> on 2001/09/01 14:18:40 UTC

Re: LogTarget factories

On Fri, 31 Aug 2001 13:52, Mircea Toma wrote:
> Hi,
>
> Here is the TextMessageBuilder changed accordingly to our discussion.
> I also created a FormattedTextMessageBuilder to replace the
> XMLMessageBuilder, the type of Formatter is passed in the contructor.
>
> ..... and, yes I finished the JMSQueueTarget that should be used in the
> JMSTargetFactory (one factory per media).

Looks good. I committed it as-is but theres a few things I am not sure about. 
Is there a need for ContentInfo ? I couldn't see any real-life reason for it 
to be honest. Removing it would decrease complexity I think.

For the odd cases that may need that style functionality we could instead 
replace it with a Formatter. Thus we would have something like

protected String getText( LogEvent event )
{
  if( null != m_formatter )
  { 
     m_formatter.format( event );
  }
  else
  {
    return event.getMessage();
  }
}

In theory we could also replace FormattedTextMessageBuilder with extra 
constructor that sets m_properties = new PropertyInfo[ 0 ];

Thoughts??

-- 
Cheers,

Pete

---------------------------------------------------------------
The difference between genius, and stupidity? Genius has limits
---------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: LogTarget factories

Posted by Mircea Toma <mi...@home.com>.
----- Original Message -----
From: "Peter Donald" <do...@apache.org>
To: "Avalon Development" <av...@jakarta.apache.org>
Sent: Saturday, September 01, 2001 6:52 PM
Subject: Re: LogTarget factories


> On Sun, 2 Sep 2001 06:33, Mircea Toma wrote:
> > Ok, I think I got it!
> >
> > A TextMessageBuilder will be able to send LogEvent 'attributes'
formatted
> > or not formatted to a JMS destination. If formatted the JMS message will
> > contain the LogEvent message plus maybe some formatted LogEvent
> > 'attributes' (like the stacktrace). If not formatted the properties can
be
> > used to do a server-side select based on their values or filtered by a
> > LogTarget.
>
> I think so ;) I see the content/message part as always containing the
> important "payload" in this case the message.
>
> So do you mind the change (ie removing ContentInfo and replacing it with
> Formatter) ?

Not at all, I would like to do it!

Mircea

>
> --
> Cheers,
>
> Pete
>
> ----------------------------------------------------------
> Which is worse: Ignorance or Apathy? Who knows? Who cares?
> ----------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: LogTarget factories

Posted by Peter Donald <do...@apache.org>.
On Sun, 2 Sep 2001 06:33, Mircea Toma wrote:
> Ok, I think I got it!
>
> A TextMessageBuilder will be able to send LogEvent 'attributes' formatted
> or not formatted to a JMS destination. If formatted the JMS message will
> contain the LogEvent message plus maybe some formatted LogEvent
> 'attributes' (like the stacktrace). If not formatted the properties can be
> used to do a server-side select based on their values or filtered by a
> LogTarget.

I think so ;) I see the content/message part as always containing the 
important "payload" in this case the message.

So do you mind the change (ie removing ContentInfo and replacing it with 
Formatter) ?

-- 
Cheers,

Pete

----------------------------------------------------------
Which is worse: Ignorance or Apathy? Who knows? Who cares?
----------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: LogTarget factories

Posted by Mircea Toma <mi...@home.com>.
Ok, I think I got it!

A TextMessageBuilder will be able to send LogEvent 'attributes' formatted or
not formatted to a JMS destination. If formatted the JMS message will
contain the LogEvent message plus maybe some formatted LogEvent 'attributes'
(like the stacktrace). If not formatted the properties can be used to do a
server-side select based on their values or filtered by a LogTarget.

Mircea


----- Original Message -----
From: "Mircea Toma" <mi...@home.com>
To: "Avalon Development" <av...@jakarta.apache.org>
Sent: Saturday, September 01, 2001 2:16 PM
Subject: Re: LogTarget factories


>
> ----- Original Message -----
> From: "Peter Donald" <do...@apache.org>
> To: "Avalon Development" <av...@jakarta.apache.org>
> Sent: Saturday, September 01, 2001 6:18 AM
> Subject: Re: LogTarget factories
>
>
> > On Fri, 31 Aug 2001 13:52, Mircea Toma wrote:
> > > Hi,
> > >
> > > Here is the TextMessageBuilder changed accordingly to our discussion.
> > > I also created a FormattedTextMessageBuilder to replace the
> > > XMLMessageBuilder, the type of Formatter is passed in the contructor.
> > >
> > > ..... and, yes I finished the JMSQueueTarget that should be used in
the
> > > JMSTargetFactory (one factory per media).
> >
> > Looks good. I committed it as-is but theres a few things I am not sure
> about.
> > Is there a need for ContentInfo ?
>
> It's there to map any LogEvent attribute to the message body not only
> 'logEvent.getMessage()' attribute (let's say I want to send messages that
> will contain only the stacktrace in the body and the category as
property).
> I guess you will say that's FS! ;)
>
> > I couldn't see any real-life reason for it
> > to be honest.
>
> To tell you the truth, I was strugling with that too but the reason why I
> did it like that you have it above.
>
> > Removing it would decrease complexity I think.
>
> Yes! ... I can change it any time!
>
> >
> > For the odd cases that may need that style functionality we could
instead
> > replace it with a Formatter. Thus we would have something like
> >
> > protected String getText( LogEvent event )
> > {
> >   if( null != m_formatter )
> >   {
> >      m_formatter.format( event );
> >   }
> >   else
> >   {
> >     return event.getMessage();
> >   }
> > }
> >
> > In theory we could also replace FormattedTextMessageBuilder with extra
> > constructor that sets m_properties = new PropertyInfo[ 0 ];
>
> .... and send the same information twice (like category, priority..), once
> in the formatted text and secondly in a message property?!
>
>
> Mircea
>
>
> >
> > Thoughts??
> >
> > --
> > Cheers,
> >
> > Pete
> >
> > ---------------------------------------------------------------
> > The difference between genius, and stupidity? Genius has limits
> > ---------------------------------------------------------------
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: LogTarget factories

Posted by Mircea Toma <mi...@home.com>.
----- Original Message -----
From: "Peter Donald" <do...@apache.org>
To: "Avalon Development" <av...@jakarta.apache.org>
Sent: Saturday, September 01, 2001 6:18 AM
Subject: Re: LogTarget factories


> On Fri, 31 Aug 2001 13:52, Mircea Toma wrote:
> > Hi,
> >
> > Here is the TextMessageBuilder changed accordingly to our discussion.
> > I also created a FormattedTextMessageBuilder to replace the
> > XMLMessageBuilder, the type of Formatter is passed in the contructor.
> >
> > ..... and, yes I finished the JMSQueueTarget that should be used in the
> > JMSTargetFactory (one factory per media).
>
> Looks good. I committed it as-is but theres a few things I am not sure
about.
> Is there a need for ContentInfo ?

It's there to map any LogEvent attribute to the message body not only
'logEvent.getMessage()' attribute (let's say I want to send messages that
will contain only the stacktrace in the body and the category as property).
I guess you will say that's FS! ;)

> I couldn't see any real-life reason for it
> to be honest.

To tell you the truth, I was strugling with that too but the reason why I
did it like that you have it above.

> Removing it would decrease complexity I think.

Yes! ... I can change it any time!

>
> For the odd cases that may need that style functionality we could instead
> replace it with a Formatter. Thus we would have something like
>
> protected String getText( LogEvent event )
> {
>   if( null != m_formatter )
>   {
>      m_formatter.format( event );
>   }
>   else
>   {
>     return event.getMessage();
>   }
> }
>
> In theory we could also replace FormattedTextMessageBuilder with extra
> constructor that sets m_properties = new PropertyInfo[ 0 ];

.... and send the same information twice (like category, priority..), once
in the formatted text and secondly in a message property?!


Mircea


>
> Thoughts??
>
> --
> Cheers,
>
> Pete
>
> ---------------------------------------------------------------
> The difference between genius, and stupidity? Genius has limits
> ---------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org