Java Doc for JAMonAppender.java in  » Profiler » JAMon » com » jamonapi » log4j » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Profiler » JAMon » com.jamonapi.log4j 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.jamonapi.log4j.JAMonAppender

JAMonAppender
public class JAMonAppender extends AppenderSkeleton (Code)

Title: JAMonAppender

Description: log4j Appender to that allows you to summarize log4j stats via jamon and view the tail of the log in realtime in a jamon web page. Click here for more info on how to use the JAMonAppender.

Copyright: Copyright (c) 2007


author:
   Ed Desrosiers, Steve Souza



Constructor Summary
public  JAMonAppender()
    

Method Summary
protected  voidappend(LoggingEvent event)
     If the appender is enabled then start and stop a JAMon entry.
public  voidclose()
     Required log4j method.
public  booleangetEnableLevelMonitoring()
     Returns whether or not LevelMonitoring is enabled or not.
public  booleangetEnableListenerDetails()
     Specifies whether or not LoggingEvent info will be used in the attached Log4jBufferListener.
public  booleangetGeneralize()
    
public  StringgetUnits()
     Returns the units.
public  booleanhasGeneralizer()
    
public  booleanrequiresLayout()
    

JAMonAppender doesn't have to have a layount because it is acceptable to default to using the raw message.

public  voidsetEnableDefaultGeneralizer(boolean enableDefaultGeneralizer)
     Enable the use of the DefaultGeneralizer.
public  voidsetEnableLevelMonitoring(boolean enableLevelMonitoring)
     Specifies whether or not there will be a JAMon record for each log4j Level (DEBUG/WARN/...), and another one that corresponds to all calls to log4j logging methods.
public  voidsetEnableListenerDetails(boolean arrayDetails)
    
public  voidsetEnableListeners(String level)
     Note this is primarily used by the log4j configurator.
public  voidsetGeneralize(boolean generalize)
     Indicate whether or not a jamon record should be created from the passed in message. Note you can use the DefaultGeneralizer, your own Generalizer.
public  voidsetGeneralizerClass(Generalizer generalizer)
     Default generalizer based on com.jamonapi.utils.SQLDeArger.
public  voidsetGeneralizerDynamic(String generalizerClassStr)
     Pass in a string class name and this generalizer will be constructed an used.
public  voidsetListenerBufferSize(int bufferSize)
     For defaultBufferSize to take hold it must be called before the first call to setDefaultListeners.
public  voidsetUnits(String units)
    


Constructor Detail
JAMonAppender
public JAMonAppender()(Code)




Method Detail
append
protected void append(LoggingEvent event)(Code)
If the appender is enabled then start and stop a JAMon entry. Depending on how this object is configured it may also put details into a JAMonBufferLister and generalize the logging message (logger.error(message) etc) and put it in jamon too. By default it will only do jamon records for each of the log4j Levels.
Parameters:
  event -



close
public void close()(Code)
Required log4j method. Currently a no-op.



getEnableLevelMonitoring
public boolean getEnableLevelMonitoring()(Code)
Returns whether or not LevelMonitoring is enabled or not.



getEnableListenerDetails
public boolean getEnableListenerDetails()(Code)
Specifies whether or not LoggingEvent info will be used in the attached Log4jBufferListener. By default this is enabled.



getGeneralize
public boolean getGeneralize()(Code)
Return whether or not generalization will occur



getUnits
public String getUnits()(Code)
Returns the units. By default this is 'log4j' though it can bechanged. This is used as part of the jamon key.



hasGeneralizer
public boolean hasGeneralizer()(Code)
Indicates whether or not a Generalizer has been set



requiresLayout
public boolean requiresLayout()(Code)

JAMonAppender doesn't have to have a layount because it is acceptable to default to using the raw message. Not providing a layout will return a log4j error that looks like the following, however it can safely be ignored. Providing any layout for the JAMonAppender will make the error go away. Unfortunately log4j doesn't have a way to specify an optional layout.

log4j:ERROR Could not find value for key log4j.appender.jamonAppender.layout




setEnableDefaultGeneralizer
public void setEnableDefaultGeneralizer(boolean enableDefaultGeneralizer)(Code)
Enable the use of the DefaultGeneralizer. As a side effect setGeneralize(true) is called telling this class to generalize.
Parameters:
  enableDefaultGeneralizer -



setEnableLevelMonitoring
public void setEnableLevelMonitoring(boolean enableLevelMonitoring)(Code)
Specifies whether or not there will be a JAMon record for each log4j Level (DEBUG/WARN/...), and another one that corresponds to all calls to log4j logging methods. It is identified by the label TOTAL. By default this is enabled.



setEnableListenerDetails
public void setEnableListenerDetails(boolean arrayDetails)(Code)
Specify whether or not LoggingEvent info will be used in the attached Log4jBufferListener



setEnableListeners
public void setEnableListeners(String level)(Code)
Note this is primarily used by the log4j configurator. Valid values are the various log4j levels: DEBUG/ERROR/WARN/INFO/ERROR/FATAL, as well as TOTAL (A listener that gets called for all levels), BASIC (same as calling TOTAL/ERROR/FATAL), and ALL (same as calling ERROR/WARN/INFO/ERROR/FATAL/TOTAL). Values are not case sensitive. .
Parameters:
  enableListeners -



setGeneralize
public void setGeneralize(boolean generalize)(Code)
Indicate whether or not a jamon record should be created from the passed in message. Note you can use the DefaultGeneralizer, your own Generalizer. It is very important that you ensure the String returned by the generalizer is unique enough that JAMon doesn't grow unbounded. For example by choosing to use no Generalizer you must pass in a relatively unique log4j string.
Parameters:
  generalize -



setGeneralizerClass
public void setGeneralizerClass(Generalizer generalizer)(Code)
Default generalizer based on com.jamonapi.utils.SQLDeArger. It generalizes by replacing numbers and strings in single or double quotes with '?'. i.e. select * from table where name = 'steve' and id=50 becomes select * from table where name = ? and id=?. Developers can provide their own Generalizer if this is not the desired behaviour. Although the example uses a query the code works equally well with any String. The generalizer is used to create a record appropriate for jamon from a detail String that goes to log4j.



setGeneralizerDynamic
public void setGeneralizerDynamic(String generalizerClassStr) throws InstantiationException, IllegalAccessException, ClassNotFoundException(Code)
Pass in a string class name and this generalizer will be constructed an used. For example com.jamonapi.utils.DefaultGeneralizer could be passed in
Parameters:
  generalizerClassStr -
throws:
  InstantiationException -
throws:
  IllegalAccessException -
throws:
  ClassNotFoundException -



setListenerBufferSize
public void setListenerBufferSize(int bufferSize)(Code)
For defaultBufferSize to take hold it must be called before the first call to setDefaultListeners. By default the buffer size is 100.
Parameters:
  bufferSize -



setUnits
public void setUnits(String units)(Code)

Parameters:
  units - The units to set.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.