You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Kenny Smith <ja...@journalscape.com> on 2003/06/25 21:00:21 UTC

[off topic] Re: How to hook into James/Phoenix Logging routines ?

Hi Richard,

There really isn't a disconnected way of doing it built into James. It's 
just a matter of using standard Java designs to accomplish the task 
(I'll explain below to point you in the right direction). This message 
is off topic for the list, but maybe it might help someone else out, so 
please forgive me if I transgress too far. :)

If you want your XmlRpcHandler to be disconnected from the Mailet 
context, my suggestion is:

1) Define your own logger interface (could simply contain one method... 
public void mylog( String msg )... ). This could be a java file like 10 
lines long (but don't use the method name log() it will collide with the 
existing log() method in GenericMailet). I'll call it MyLogger..

2) Have your mailet implement the MyLogger interface and add a method to 
the mailet called mylog() that simply calls log(), which is the standard 
  way a mailet writes to the mailet-xxxxxxx.log

3) Have your XmlRpcHandler constructor take a reference to an instance 
of MyLogger. Then when constructing it, pass 'this' to it.

4) Whenever your XmlRpcHanldler wants to log a message, it calls the 
mylog() method on it's MyLogger.

The above should get you a basic framework where your XmlRpcHandlers can 
write log messages without knowing where they are being called from.

Kenny Smith
JournalScape.com



Richard Clark wrote:
> Hi, I am new to James, and have also only been working with Java for a
> few months (C die hard), so forgive me if I am missing a blatantly
> obvious answer ;)
> 
> My question is, Is it possible (and how) to call/hook into the logging
> functions of James.  
> 
> I have a mailet (which seems to be working fine) to process XML-RPC
> calls in email attachments.  The mailet launches a handler object with a
> call to Apache's XmlRpcServer.execute().  
> 
> What I want to be able to do is perform logging to the James
> mailet-xxxxxxx.log from withing my XmlRpcHandler object which has no
> knowledge of the GenericMailet object.
> 
> Thanks in advance for any pointers.
> 
> -Richard C
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-user-help@jakarta.apache.org
> 
> 


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


Re: [off topic] Re: How to hook into James/Phoenix Logging routines ?

Posted by Richard Clark <ri...@cybrick.com>.
On Wed, 2003-06-25 at 12:00, Kenny Smith wrote:

> 3) Have your XmlRpcHandler constructor take a reference to an instance 
> of MyLogger. Then when constructing it, pass 'this' to it.
> 

Thanks, this was the trick I needed.
I seems quite obvious now that you have pointed it out ;)

Sorry for the off topic post, though the getMailetContext() suggestion
in another reply has also given me some idea. That is sort of on topic?



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


RE: Saving "session" information

Posted by "Noel J. Bergman" <no...@devtech.com>.
> I was thinking it would be nice if [meta-data about a message]
> could be cached someplace (like in the Mail object?) and pulled
> out by the each mailet as needed.

Mail attributes are coming.  They were planned for James v3, but it looks
like they will make it into James v2.2.

	--- Noel


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


RE: Saving "session" information

Posted by Danny Angus <da...@apache.org>.
> Hmm. Thats the James 3 version of org.apache.mailet.Mail, not the current
> version. Guess its coming but not here yet.

It is the MailetAPI v3

d.

RE: Saving "session" information

Posted by Steve Brewin <sb...@synsys.com>.
Hmm. Thats the James 3 version of org.apache.mailet.Mail, not the current
version. Guess its coming but not here yet.

-- Steve

> -----Original Message-----
> From: Steve Brewin [mailto:sbrewin@synsys.com]
> Sent: 25 June 2003 22:13
> To: 'James Users List'
> Subject: RE: Saving "session" information
>
>
> Look at org.apache.mailet.Mail getAttribute() &
> setAttribute(). Seems to be
> what you are looking for.
> Never tried it though.
>
> -- Steve
>
> > -----Original Message-----
> > From: Jim Janson [mailto:jjanson@adelphia.net]
> > Sent: 25 June 2003 21:52
> > To: James Users List
> > Subject: Saving "session" information
> >
> >
> > Hi,
> >
> > I have several mailets that are used in the processing of
> > mail messages.
> > A couple of them end up querying a database for the same
> information;
> > in this case, some properties related to the sender and/or
> recipients.
> > I was thinking it would be nice if this information could be cached
> > someplace (like in the Mail object?) and pulled out by the
> each mailet
> > as needed.  Obviously the lifetime of the cached
> information is pretty
> > short; once the message is stored/forwarded it's gone but it
> > still seems
> > like it could be useful.
> >
> > Does this functionality exist?  Does it make sense or is
> > there a better
> > way to get this functionality?
> >
> > Thanks.
> >
> > Jim
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: james-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-user-help@jakarta.apache.org
>


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


RE: Saving "session" information

Posted by Steve Brewin <sb...@synsys.com>.
Look at org.apache.mailet.Mail getAttribute() & setAttribute(). Seems to be
what you are looking for.
Never tried it though.

-- Steve

> -----Original Message-----
> From: Jim Janson [mailto:jjanson@adelphia.net]
> Sent: 25 June 2003 21:52
> To: James Users List
> Subject: Saving "session" information
>
>
> Hi,
>
> I have several mailets that are used in the processing of
> mail messages.
> A couple of them end up querying a database for the same information;
> in this case, some properties related to the sender and/or recipients.
> I was thinking it would be nice if this information could be cached
> someplace (like in the Mail object?) and pulled out by the each mailet
> as needed.  Obviously the lifetime of the cached information is pretty
> short; once the message is stored/forwarded it's gone but it
> still seems
> like it could be useful.
>
> Does this functionality exist?  Does it make sense or is
> there a better
> way to get this functionality?
>
> Thanks.
>
> Jim
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-user-help@jakarta.apache.org
>


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


Saving "session" information

Posted by Jim Janson <jj...@adelphia.net>.
Hi,

I have several mailets that are used in the processing of mail messages.
A couple of them end up querying a database for the same information;
in this case, some properties related to the sender and/or recipients.
I was thinking it would be nice if this information could be cached
someplace (like in the Mail object?) and pulled out by the each mailet
as needed.  Obviously the lifetime of the cached information is pretty
short; once the message is stored/forwarded it's gone but it still seems
like it could be useful. 

Does this functionality exist?  Does it make sense or is there a better
way to get this functionality?

Thanks.

Jim


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