org.wso2.carbon.utils.logging.appenders
Class IMAppender

java.lang.Object
  extended by org.apache.log4j.AppenderSkeleton
      extended by org.wso2.carbon.utils.logging.appenders.IMAppender
All Implemented Interfaces:
org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler

public class IMAppender
extends org.apache.log4j.AppenderSkeleton

IMAppender appends tracing requests through instant messaging network.

Version:
$Revision: 1.2 $
Author:
Rafael Luque & Ruth Zamorano

Field Summary
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
IMAppender()
          The default constructor will instantiate the appender with a default TriggeringEventEvaluator that will trigger on events with level ERROR or higher.
IMAppender(org.apache.log4j.spi.TriggeringEventEvaluator evaluator)
           
 
Method Summary
 void activateOptions()
          Options are activated and become effective only after calling this method.
 void append(org.apache.log4j.spi.LoggingEvent event)
          This method called by AppenderSkeleton.doAppend(org.apache.log4j.spi.LoggingEvent) method does most of the real appending work.
protected  boolean checkEntryConditions()
          This method determines if there is a sense in attempting to append.
 void close()
          Close this IMAppender.
 int getBufferSize()
           
 String getEvaluatorClass()
           
 String getHost()
           
 String getNickname()
           
 String getPassword()
           
 int getPort()
           
 String getRecipient()
           
 String getUsername()
           
 boolean isChatroom()
           
 boolean isSSL()
           
 boolean requiresLayout()
          The IMAppender requires a layout.
protected  void sendBuffer()
          Send the contents of the cyclic buffer as an IM message.
 void setBufferSize(int bufferSize)
           
 void setChatroom(boolean chatroom)
           
 void setEvaluatorClass(String value)
          The EvaluatorClass option takes a string value representing the name of the class implementing the TriggeringEventEvaluator interface.
 void setHost(String host)
           
 void setNickname(String nickname)
           
 void setPassword(String password)
           
 void setPort(int port)
           
 void setRecipient(String recipient)
           
 void setSSL(boolean enableSSL)
           
 void setUsername(String username)
           
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
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
 

Constructor Detail

IMAppender

public IMAppender()
The default constructor will instantiate the appender with a default TriggeringEventEvaluator that will trigger on events with level ERROR or higher.


IMAppender

public IMAppender(org.apache.log4j.spi.TriggeringEventEvaluator evaluator)
Method Detail

getHost

public String getHost()

setHost

public void setHost(String host)

getPort

public int getPort()

setPort

public void setPort(int port)

getUsername

public String getUsername()

setUsername

public void setUsername(String username)

getPassword

public String getPassword()

setPassword

public void setPassword(String password)

getRecipient

public String getRecipient()

setRecipient

public void setRecipient(String recipient)

isChatroom

public boolean isChatroom()

setChatroom

public void setChatroom(boolean chatroom)

getNickname

public String getNickname()

setNickname

public void setNickname(String nickname)

isSSL

public boolean isSSL()

setSSL

public void setSSL(boolean enableSSL)

getBufferSize

public int getBufferSize()

setBufferSize

public void setBufferSize(int bufferSize)

setEvaluatorClass

public void setEvaluatorClass(String value)
The EvaluatorClass option takes a string value representing the name of the class implementing the TriggeringEventEvaluator interface. A corresponding object will be instantiated and assigned as the triggering event evaluator for the SMTPAppender.


getEvaluatorClass

public String getEvaluatorClass()

activateOptions

public void activateOptions()
Options are activated and become effective only after calling this method.

Specified by:
activateOptions in interface org.apache.log4j.spi.OptionHandler
Overrides:
activateOptions in class org.apache.log4j.AppenderSkeleton

close

public void close()
Close this IMAppender. Closing all resources used by the appender. A closed appender cannot be re-opened.


append

public void append(org.apache.log4j.spi.LoggingEvent event)
This method called by AppenderSkeleton.doAppend(org.apache.log4j.spi.LoggingEvent) method does most of the real appending work. Adds the event to a buffer and checks if the event triggers a message to be sent.

Specified by:
append in class org.apache.log4j.AppenderSkeleton

sendBuffer

protected void sendBuffer()
Send the contents of the cyclic buffer as an IM message.


checkEntryConditions

protected boolean checkEntryConditions()
This method determines if there is a sense in attempting to append.

It checks whether there is an output chat available and also if there is a set layout. If these checks fail, then the boolean value false is returned.


requiresLayout

public boolean requiresLayout()
The IMAppender requires a layout. Hence, this method returns true.



Copyright © 2014 WSO2 Inc. All rights reserved.