excalibur-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leif Mortenson <leifli...@tanukisoftware.com>
Subject SMTPTargetFactory for logging with Fortress
Date Mon, 26 Jul 2004 05:01:35 GMT
Hi,
I have been spending today attempting to figure out how to use the
SMTPTargetFactory with Fortress.

As I understand it, you would place something like the following in your
.xlog file:

<factories>
<factory type="smtp"
class="org.apache.avalon.excalibur.logger.factory.SMTPTargetFactory"/>
<factory type="priority-filter"
class="org.apache.avalon.excalibur.logger.factory.PriorityFilterTargetFactory"/>
</factories>

<targets>
<priority-filter id="admin-mail" log-level="WARN">
<smtp context-key="smtp-session-context">
<to>user@domain</to>
<from>sender@domain</from>
<subject>Subject</subject>
<maximum-size>1</maximum-size>
<format type="extended">
%7.7{priority} [%32.32{category}] (%{context}): %{message}\n%{throwable}
</format>
</smtp>
</priority-filter>
</targets>

The problem that I am running into is that the SMTPTargetFactory looks for a
JavaMail Session instance in the context of the factory. Tracing back
through the
code, this context appears to be the root context which is passed to the
DefaultContainerManager constructor when starting up Fortress.

That Context object is obtained by calling getContext on my FortressConfig
instance, and is thus read only.

My question is: What is the preferred way to set values in the Fortress
context? Or, if I am going down the wrong track, how do I get the SMTP
Target
Factory working? :-)

I was also wondering why the SMTPTargetFactory simply does not allow you
to specify the SMTP host in its configuration. If that was possible,
then it would
be easy to completely self contain the configuration information for
sending the
log events.

Cheers,
Leif


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/


Mime
View raw message