Project Wonder 2.0

er.extensions
Class ERXMailAppender

java.lang.Object
  extended byorg.apache.log4j.AppenderSkeleton
      extended byer.extensions.ERXMailAppender
All Implemented Interfaces:
Appender, OptionHandler
Direct Known Subclasses:
ERCMailMessageAppender

public class ERXMailAppender
extends AppenderSkeleton

Basic log4j Mail Message Appender
Used for logging log events that will eventually be emailed out. Logs events using WOMailDelivery. Manditory Fields:
TOAddresses - comma seperated list of email addresses to send the log event message to. FromAddress - Who the message is from, if left blank then DomainName is a manditory field. Optional Fields:
BccAddresses - comma separated list of email address to bcc on the email CcAddresses - comma separated list of email address to cc on the email ReplyTo - reply to address DomainName - When generating a from email address, used for the bit after the


Field Summary
protected  String bccAddresses
          holds the bcc addresses
protected  String ccAddresses
          holds the cc addresses
protected  String computedFromAddress
          holds the computed from address
protected  boolean conditionsChecked
          holds the flag if all the conditions for logging have been checked
protected  String domainName
          holds the domain
protected  String exceptionPageName
          holds the exception page name
protected  String formatAsError
           
protected  String fromAddress
          holds the from address
protected  String hostName
          holds the host name
protected  String qualifier
          holds the qualifier
protected  EOQualifier realQualifier
          holds the qualifier
protected  String replyTo
          holds the reply to address
protected  String title
          holds the title
protected  String titleIncludesApplicationName
           
protected  String titleIncludesPriorityLevel
           
protected  String toAddresses
          holds the to addresses
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
ERXMailAppender()
          Public constructor.
 
Method Summary
 void append(LoggingEvent event)
          Entry point for logging an event.
 String bccAddresses()
          Gets the bcc addresses as a String.
 NSArray bccAddressesAsArray()
          Gets the bcc addresses as an array.
 String ccAddresses()
          Gets the cc addresses as a String.
 NSArray ccAddressesAsArray()
          Gets the cc addresses as an array.
protected  boolean checkConditions()
          Used to determine if the system is ready to log events with MERCMailDelivery.
 void close()
          When closed set the state to closed.
 NSMutableDictionary composeExceptionPageDictionary(LoggingEvent event)
          In case we generate a HTML page, we construct a dictionary with the entries that is later pushed into the page.
 String composeMessage(LoggingEvent event)
          Where the actual logging event is processed and a mail message is generated.
 String composeTitle(LoggingEvent event)
           
 String computedFromAddress()
          Gets the from address for the appender.
 String formatAsError()
           
 boolean formatAsErrorAsBoolean()
           
 String getDomainName()
          Gets the domain name.
 String getExceptionPageName()
          Gets the exception page name.
 String getFromAddress()
          Gets the from address set by the user.
 String getHostName()
          Gets the host name.
 String getQualifier()
          Gets the qualifier as a string.
 String getReplyTo()
          Gets the reply to address set by the user.
 String getTitle()
          Gets the title.
 String getToAddresses()
          Gets the to addresses as a string.
 EOQualifier realQualifier()
          Gets the qualifier.
 boolean requiresLayout()
          The mail message appender does require a layout.
 void setBccAddresses(String bccAddresses)
          Sets the bcc addresses as a string.
 void setCcAddresses(String ccAddresses)
          Sets the to addresses as a string.
 void setDomainName(String domainName)
          Sets the domain name.
 void setExceptionPageName(String exceptionPageName)
          Sets the title.
 void setFormatAsError(String value)
           
 void setFromAddress(String fromAddress)
          Sets the from address.
 void setHostName(String hostName)
          Sets the host name to use for the given appender.
 void setQualifier(String qualifier)
          Sets the qualifier as a string.
 void setReplyTo(String replyTo)
          Sets the reply to address.
 void setTitle(String title)
          Sets the title.
 void setTitleIncludesApplicationName(String value)
           
 void setTitleIncludesPriorityLevel(String value)
           
 void setToAddresses(String toAddresses)
          Sets the to addresses as a string.
 void subAppend(LoggingEvent event)
          Where the actual logging event is processed and a mail message is generated.
 String titleIncludesApplicationName()
           
 boolean titleIncludesApplicationNameAsBoolean()
           
 String titleIncludesPriorityLevel()
           
 boolean titleIncludesPriorityLevelAsBoolean()
           
 NSArray toAddressesAsArray()
          Gets the to addresses as an array.
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fromAddress

protected String fromAddress
holds the from address


computedFromAddress

protected String computedFromAddress
holds the computed from address


replyTo

protected String replyTo
holds the reply to address


toAddresses

protected String toAddresses
holds the to addresses


ccAddresses

protected String ccAddresses
holds the cc addresses


bccAddresses

protected String bccAddresses
holds the bcc addresses


domainName

protected String domainName
holds the domain


qualifier

protected String qualifier
holds the qualifier


realQualifier

protected EOQualifier realQualifier
holds the qualifier


title

protected String title
holds the title


exceptionPageName

protected String exceptionPageName
holds the exception page name


hostName

protected String hostName
holds the host name


formatAsError

protected String formatAsError

titleIncludesPriorityLevel

protected String titleIncludesPriorityLevel

titleIncludesApplicationName

protected String titleIncludesApplicationName

conditionsChecked

protected boolean conditionsChecked
holds the flag if all the conditions for logging have been checked

Constructor Detail

ERXMailAppender

public ERXMailAppender()
Public constructor.

Method Detail

requiresLayout

public boolean requiresLayout()
The mail message appender does require a layout.

Returns:
true.

close

public void close()
When closed set the state to closed. Closes the current appender.


getQualifier

public String getQualifier()
Gets the qualifier as a string.

Returns:
the qualifier as string.

setQualifier

public void setQualifier(String qualifier)
Sets the qualifier as a string.


realQualifier

public EOQualifier realQualifier()
Gets the qualifier.

Returns:
the from address.

getFromAddress

public String getFromAddress()
Gets the from address set by the user.

Returns:
the from address.

setFromAddress

public void setFromAddress(String fromAddress)
Sets the from address.

Parameters:
fromAddress - to use when generating emails.

getReplyTo

public String getReplyTo()
Gets the reply to address set by the user.

Returns:
the reply to address.

setReplyTo

public void setReplyTo(String replyTo)
Sets the reply to address.


computedFromAddress

public String computedFromAddress()
Gets the from address for the appender. If a from address is not specified then an address is constructed in the form: applicationName-hostName@domainName.

Returns:
the from address.

getToAddresses

public String getToAddresses()
Gets the to addresses as a string.

Returns:
to addresses as a string

setToAddresses

public void setToAddresses(String toAddresses)
Sets the to addresses as a string.

Parameters:
toAddresses - comma separated array of email addresses

toAddressesAsArray

public NSArray toAddressesAsArray()
Gets the to addresses as an array.

Returns:
the to addresses as an array.

setCcAddresses

public void setCcAddresses(String ccAddresses)
Sets the to addresses as a string.

Parameters:
ccAddresses - comma separated array of email addresses

ccAddresses

public String ccAddresses()
Gets the cc addresses as a String.

Returns:
cc addresses as a string

ccAddressesAsArray

public NSArray ccAddressesAsArray()
Gets the cc addresses as an array.

Returns:
the cc addresses as an array.

setBccAddresses

public void setBccAddresses(String bccAddresses)
Sets the bcc addresses as a string.

Parameters:
bccAddresses - comma separated array of email addresses

bccAddresses

public String bccAddresses()
Gets the bcc addresses as a String.

Returns:
bcc addresses as a string

bccAddressesAsArray

public NSArray bccAddressesAsArray()
Gets the bcc addresses as an array.

Returns:
the bcc addresses as an array.

getExceptionPageName

public String getExceptionPageName()
Gets the exception page name.

Returns:
exception page name.

setExceptionPageName

public void setExceptionPageName(String exceptionPageName)
Sets the title.


getTitle

public String getTitle()
Gets the title.

Returns:
title.

setTitle

public void setTitle(String title)
Sets the title.

Parameters:
title - of the mail message

getHostName

public String getHostName()
Gets the host name. If one is not specified then the host name of the machine will be used.

Returns:
host name to use when constructing the 'from' email address.

setHostName

public void setHostName(String hostName)
Sets the host name to use for the given appender.

Parameters:
hostName - for the appender.

getDomainName

public String getDomainName()
Gets the domain name.

Returns:
domain name.

setDomainName

public void setDomainName(String domainName)
Sets the domain name.

Parameters:
domainName - new domain name

formatAsError

public String formatAsError()

setFormatAsError

public void setFormatAsError(String value)

formatAsErrorAsBoolean

public boolean formatAsErrorAsBoolean()

titleIncludesPriorityLevel

public String titleIncludesPriorityLevel()

setTitleIncludesPriorityLevel

public void setTitleIncludesPriorityLevel(String value)

titleIncludesPriorityLevelAsBoolean

public boolean titleIncludesPriorityLevelAsBoolean()

titleIncludesApplicationName

public String titleIncludesApplicationName()

setTitleIncludesApplicationName

public void setTitleIncludesApplicationName(String value)

titleIncludesApplicationNameAsBoolean

public boolean titleIncludesApplicationNameAsBoolean()

checkConditions

protected boolean checkConditions()
Used to determine if the system is ready to log events with MERCMailDelivery.

Returns:
true if all of the conditions are satisfied

append

public void append(LoggingEvent event)
Entry point for logging an event. Reminder: the nesting of calls is: doAppend() - check threshold - filter - append(); - checkConditions(); - subAppend();

Parameters:
event - current logging event

composeTitle

public String composeTitle(LoggingEvent event)

composeExceptionPageDictionary

public NSMutableDictionary composeExceptionPageDictionary(LoggingEvent event)
In case we generate a HTML page, we construct a dictionary with the entries that is later pushed into the page. This is the place to override and extend in case you want to provide your own pages. Current keys are: extraInfo - NSDictionary of extra info from the application errorMessage - the title for the message formattedMessage - the actual message exception - the throwable given by the event reasonLines - NSArray of strings that give the backtrace

Parameters:
event - logging event

composeMessage

public String composeMessage(LoggingEvent event)
Where the actual logging event is processed and a mail message is generated.

Parameters:
event - logging event

subAppend

public void subAppend(LoggingEvent event)
Where the actual logging event is processed and a mail message is generated.

Parameters:
event - logging event

Last updated: Do, Dez 9, 2004 • 12:46 PM CET

Copyright © 2002 – 2004 Project Wonder.