Project Wonder 5.0

er.extensions.logging
Class ERXMailAppender

java.lang.Object
  extended by org.apache.log4j.AppenderSkeleton
      extended by er.extensions.logging.ERXMailAppender
All Implemented Interfaces:
org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler
Direct Known Subclasses:
ERCMailMessageAppender

public class ERXMailAppender
extends org.apache.log4j.AppenderSkeleton

Basic log4j Mail Message Appender.
Used for logging log events that will eventually be emailed out. Logs events using WOMailDelivery.

Mandatory Fields:
ToAddresses - comma separated list of email addresses to send the log event message to.
FromAddress - Who the message is from, if left blank then DomainName is a mandatory 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 "@", ie foo@bar.com, the domain name is 'bar.com'.
HostName - When generating an email address from, defaults to name of the localhost.
ExceptionPage - name of the exception page, is unset,
Title - Title of the email messages, if not specified the title will be a truncated version of the log message.
Qualifier - qualifier that defines if the event should be logged.


Field Summary
protected  java.lang.String bccAddresses
          holds the bcc addresses
protected  java.lang.String ccAddresses
          holds the cc addresses
protected  java.lang.String computedFromAddress
          holds the computed from address
protected  boolean conditionsChecked
          holds the flag if all the conditions for logging have been checked
protected  java.lang.String domainName
          holds the domain
protected  java.lang.String exceptionPageName
          holds the exception page name
protected  java.lang.String formatAsError
           
protected  java.lang.String fromAddress
          holds the from address
protected  java.lang.String hostName
          holds the host name
protected  java.lang.String qualifier
          holds the qualifier
protected  com.webobjects.eocontrol.EOQualifier realQualifier
          holds the qualifier
protected  java.lang.String replyTo
          holds the reply to address
protected  java.lang.String title
          holds the title
protected  java.lang.String titleIncludesApplicationName
           
protected  java.lang.String titleIncludesPriorityLevel
           
protected  java.lang.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(org.apache.log4j.spi.LoggingEvent event)
          Entry point for logging an event.
 java.lang.String bccAddresses()
          Gets the bcc addresses as a String.
 com.webobjects.foundation.NSArray bccAddressesAsArray()
          Gets the bcc addresses as an array.
 java.lang.String ccAddresses()
          Gets the cc addresses as a String.
 com.webobjects.foundation.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.
 com.webobjects.foundation.NSMutableDictionary composeExceptionPageDictionary(org.apache.log4j.spi.LoggingEvent event)
          In case we generate a HTML page, we construct a dictionary with the entries that is later pushed into the page.
 java.lang.String composeMessage(org.apache.log4j.spi.LoggingEvent event)
          Where the actual logging event is processed and a mail message is generated.
 java.lang.String composeTitle(org.apache.log4j.spi.LoggingEvent event)
           
 java.lang.String computedFromAddress()
          Gets the from address for the appender.
 java.lang.String formatAsError()
           
 boolean formatAsErrorAsBoolean()
           
 java.lang.String getDomainName()
          Gets the domain name.
 java.lang.String getExceptionPageName()
          Gets the exception page name.
 java.lang.String getFromAddress()
          Gets the from address set by the user.
 java.lang.String getHostName()
          Gets the host name.
 java.lang.String getQualifier()
          Gets the qualifier as a string.
 java.lang.String getReplyTo()
          Gets the reply to address set by the user.
 java.lang.String getTitle()
          Gets the title.
 java.lang.String getToAddresses()
          Gets the to addresses as a string.
 com.webobjects.eocontrol.EOQualifier realQualifier()
          Gets the qualifier.
 boolean requiresLayout()
          The mail message appender does require a layout.
 void setBccAddresses(java.lang.String bccAddresses)
          Sets the bcc addresses as a string.
 void setCcAddresses(java.lang.String ccAddresses)
          Sets the to addresses as a string.
 void setDomainName(java.lang.String domainName)
          Sets the domain name.
 void setExceptionPageName(java.lang.String exceptionPageName)
          Sets the title.
 void setFormatAsError(java.lang.String value)
           
 void setFromAddress(java.lang.String fromAddress)
          Sets the from address.
 void setHostName(java.lang.String hostName)
          Sets the host name to use for the given appender.
 void setQualifier(java.lang.String qualifier)
          Sets the qualifier as a string.
 void setReplyTo(java.lang.String replyTo)
          Sets the reply to address.
 void setTitle(java.lang.String title)
          Sets the title.
 void setTitleIncludesApplicationName(java.lang.String value)
           
 void setTitleIncludesPriorityLevel(java.lang.String value)
           
 void setToAddresses(java.lang.String toAddresses)
          Sets the to addresses as a string.
 void subAppend(org.apache.log4j.spi.LoggingEvent event)
          Where the actual logging event is processed and a mail message is generated.
 java.lang.String titleIncludesApplicationName()
           
 boolean titleIncludesApplicationNameAsBoolean()
           
 java.lang.String titleIncludesPriorityLevel()
           
 boolean titleIncludesPriorityLevelAsBoolean()
           
 com.webobjects.foundation.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 java.lang.String fromAddress
holds the from address


computedFromAddress

protected java.lang.String computedFromAddress
holds the computed from address


replyTo

protected java.lang.String replyTo
holds the reply to address


toAddresses

protected java.lang.String toAddresses
holds the to addresses


ccAddresses

protected java.lang.String ccAddresses
holds the cc addresses


bccAddresses

protected java.lang.String bccAddresses
holds the bcc addresses


domainName

protected java.lang.String domainName
holds the domain


qualifier

protected java.lang.String qualifier
holds the qualifier


realQualifier

protected com.webobjects.eocontrol.EOQualifier realQualifier
holds the qualifier


title

protected java.lang.String title
holds the title


exceptionPageName

protected java.lang.String exceptionPageName
holds the exception page name


hostName

protected java.lang.String hostName
holds the host name


formatAsError

protected java.lang.String formatAsError

titleIncludesPriorityLevel

protected java.lang.String titleIncludesPriorityLevel

titleIncludesApplicationName

protected java.lang.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.

Specified by:
requiresLayout in interface org.apache.log4j.Appender
Specified by:
requiresLayout in class org.apache.log4j.AppenderSkeleton
Returns:
true.

close

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

Specified by:
close in interface org.apache.log4j.Appender
Specified by:
close in class org.apache.log4j.AppenderSkeleton

getQualifier

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

Returns:
the qualifier as string.

setQualifier

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

Parameters:
qualifier - the qualifier as string.

realQualifier

public com.webobjects.eocontrol.EOQualifier realQualifier()
Gets the qualifier.

Returns:
the from address.

getFromAddress

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

Returns:
the from address.

setFromAddress

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

Parameters:
fromAddress - to use when generating emails.

getReplyTo

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

Returns:
the reply to address.

setReplyTo

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

Parameters:
replyTo - to address to use when generating emails.

computedFromAddress

public java.lang.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 java.lang.String getToAddresses()
Gets the to addresses as a string.

Returns:
to addresses as a string

setToAddresses

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

Parameters:
toAddresses - comma separated array of email addresses

toAddressesAsArray

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

Returns:
the to addresses as an array.

setCcAddresses

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

Parameters:
ccAddresses - comma separated array of email addresses

ccAddresses

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

Returns:
cc addresses as a string

ccAddressesAsArray

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

Returns:
the cc addresses as an array.

setBccAddresses

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

Parameters:
bccAddresses - comma separated array of email addresses

bccAddresses

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

Returns:
bcc addresses as a string

bccAddressesAsArray

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

Returns:
the bcc addresses as an array.

getExceptionPageName

public java.lang.String getExceptionPageName()
Gets the exception page name.

Returns:
exception page name.

setExceptionPageName

public void setExceptionPageName(java.lang.String exceptionPageName)
Sets the title.

Parameters:
exceptionPageName - title of the mail message

getTitle

public java.lang.String getTitle()
Gets the title.

Returns:
title.

setTitle

public void setTitle(java.lang.String title)
Sets the title.

Parameters:
title - of the mail message

getHostName

public java.lang.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(java.lang.String hostName)
Sets the host name to use for the given appender.

Parameters:
hostName - for the appender.

getDomainName

public java.lang.String getDomainName()
Gets the domain name.

Returns:
domain name.

setDomainName

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

Parameters:
domainName - new domain name

formatAsError

public java.lang.String formatAsError()

setFormatAsError

public void setFormatAsError(java.lang.String value)

formatAsErrorAsBoolean

public boolean formatAsErrorAsBoolean()

titleIncludesPriorityLevel

public java.lang.String titleIncludesPriorityLevel()

setTitleIncludesPriorityLevel

public void setTitleIncludesPriorityLevel(java.lang.String value)

titleIncludesPriorityLevelAsBoolean

public boolean titleIncludesPriorityLevelAsBoolean()

titleIncludesApplicationName

public java.lang.String titleIncludesApplicationName()

setTitleIncludesApplicationName

public void setTitleIncludesApplicationName(java.lang.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(org.apache.log4j.spi.LoggingEvent event)
Entry point for logging an event. Reminder: the nesting of calls is: doAppend() - check threshold - filter - append(); - checkConditions(); - subAppend();

Specified by:
append in class org.apache.log4j.AppenderSkeleton
Parameters:
event - current logging event

composeTitle

public java.lang.String composeTitle(org.apache.log4j.spi.LoggingEvent event)

composeExceptionPageDictionary

public com.webobjects.foundation.NSMutableDictionary composeExceptionPageDictionary(org.apache.log4j.spi.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 java.lang.String composeMessage(org.apache.log4j.spi.LoggingEvent event)
Where the actual logging event is processed and a mail message is generated.

Parameters:
event - logging event

subAppend

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

Parameters:
event - logging event

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.