Java Doc for Debug.java in  » Portal » Open-Portal » com » sun » portal » util » 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 » Portal » Open Portal » com.sun.portal.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.portal.util.Debug

Debug
public class Debug (Code)

Allows a uniform interface to file debug and exception information in a uniform format. Debug supports different levels/states of filing debug information (in the ascending order): OFF, ERROR,WARNING,MESSAGE and ON. A given debug level/state is enabled if the debug state/level is set to at least that state/level. For example, if the debug state is ERROR, only errors will be filed. If the debug state is WARNING, only errors and warnings will be filed. If the debug state is MESSAGE, everything will be filed. MESSAGE and ON are of the same levels; the difference between them being MESSAGE writes to a file, whereas ON writes to System.out.

Debug files are created in the directory specified by the property, gateway.debug.dir, in /etc/opt/SUNWportal/platform.conf file. The default value for this property is /var/opt/SUNWportal/debug.

NOTE: Debugging is an IO intensive operation and may hurt application performance when abused. Particularly, note that Java evaluates the arguments to message() and warning() even when debugging is turned off. It is recommended that the debug state be checked before invoking any message() or warning() methods to avoid unnecessary argument evaluation and to maximize application performance.



Field Summary
final public static  intERROR
     flags the state where error debugging is enabled.
final public static  intMESSAGE
     This state enables debugging of messages, warnings and errors.
final public static  intOFF
     flags the disabled debug state.
final public static  intON
     flags the enabled debug state for warnings, errors and messages.
final public static  intWARNING
     flags the state where warning debugging is enabled, but message debugging is disabled.

Constructor Summary
public  Debug(String debugName)
     This constructor takes as an argument the name of the debug file.

Method Summary
public  booleandebugEnabled()
     Checks if message debugging is enabled.

NOTE: It is recommended that messageEnabled() be used instead of debugEnabled() as the former is more intuitive.

public  voiddestroy()
     Destroys the debug object, closes the debug file and releases any system resources.
public  voiderror(String msg)
     Prints error messages only when debug level is greater than DEBUG.OFF.
public  voiderror(String msg, Throwable t)
     Prints error messages only if debug state is greater than Debug.OFF.
public  booleanerrorEnabled()
    
protected  voidfinalize()
     Flushes and then closes the debug file.
public static synchronized  DebuggetInstance(String debugName)
     Gets an existing instance of Debug for the specified debug file or a new one if no such instance already exists.
public  intgetState()
    
public  voidmessage(String msg)
     Prints messages only when the debug state is either DEBUG.MESSAGE or Debug.ON.

NOTE: Debugging is an IO intensive operation and may hurt application performance when abused.

public  voidmessage(String msg, Throwable t)
    

Prints debug and exception messages only when the debug state is either DEBUG.MESSAGE or Debug.ON.

public  booleanmessageEnabled()
     Checks if message debugging is enabled.

NOTE: Debugging is an IO intensive operation and may hurt application performance when abused.

public  voidsetDebug(int debugType)
     Sets the debug capabilities based on the values of the debugType argument.
public  voidsetDebug()
     Enables or disables degbugging based on the value of debug attribute, gateway.debug, in the platform config file, /etc/opt/SUNWportal/platform.conf.
public  voidsetDebug(String debugType)
     Sets the debug capabilities based on the values of the debugType argument.
public  voidwarning(String msg)
     Prints warning messages only when debug level is greater than DEBUG.ERROR.

NOTE: Debugging is an IO intensive operation and may hurt application performance when abused.

public  voidwarning(String msg, Throwable t)
     Prints warning messages only when debug level is greater than DEBUG.ERROR.

NOTE: Debugging is an IO intensive operation and may hurt application performance when abused.

public  booleanwarningEnabled()
     Checks if warning debugging is enabled.

NOTE: Debugging is an IO intensive operation and may hurt application performance when abused.


Field Detail
ERROR
final public static int ERROR(Code)
flags the state where error debugging is enabled. When debugging is set to less than ERROR, error debugging is also disabled.



MESSAGE
final public static int MESSAGE(Code)
This state enables debugging of messages, warnings and errors.



OFF
final public static int OFF(Code)
flags the disabled debug state.



ON
final public static int ON(Code)
flags the enabled debug state for warnings, errors and messages. Printing to a file is disabled. All printing is done on System.out.



WARNING
final public static int WARNING(Code)
flags the state where warning debugging is enabled, but message debugging is disabled. When debugging is set to less than WARNING, warning debugging is also disabled.




Constructor Detail
Debug
public Debug(String debugName)(Code)
This constructor takes as an argument the name of the debug file. The debug file is neither created nor opened until the first time message(),warning() or error() is invoked and the debug state is neither OFF nor ON.

NOTE: The recommended and preferred method to create Debug objects is getInstance(String). This constructor may be deprecated in future.


Parameters:
  debugFileName - name of the debug file to create or use
See Also:   Debug.getInstance




Method Detail
debugEnabled
public boolean debugEnabled()(Code)
Checks if message debugging is enabled.

NOTE: It is recommended that messageEnabled() be used instead of debugEnabled() as the former is more intuitive. true if message debugging is enabledfalse if message debugging is disabled
See Also:   Debug.messageEnabled




destroy
public void destroy()(Code)
Destroys the debug object, closes the debug file and releases any system resources. Note that the debug file will remain open until destroy() is invoked. To conserve file resources, you should invoke destroy() explicitly rather than wait for the garbage collector to clean up.

If this object is accessed after destroy() has been invoked, the results are undefined.




error
public void error(String msg)(Code)
Prints error messages only when debug level is greater than DEBUG.OFF.
See Also:   Debug.error(String msgThrowable t)



error
public void error(String msg, Throwable t)(Code)
Prints error messages only if debug state is greater than Debug.OFF. If the debug file is not accessible and debugging is enabled, the message along with a timestamp and thread info will be printed on System.out.

This method creates the debug file if does not exist; otherwise it starts appending to the existing debug file. When invoked for the first time on this object, the method writes a line delimiter of '*'s.

Note that the debug file will remain open until destroy() is invoked. To conserve file resources, you should invoke destroy() explicitly rather than wait for the garbage collector to clean up.


Parameters:
  msg - message to be printed. A newline will be appended to themessage before printing either to System.out orto the debug file. If msg is null, it isignored.
Parameters:
  t - Throwable, on which printStackTrace() will beinvoked to print the stack trace. If t is null,it is ignored.



errorEnabled
public boolean errorEnabled()(Code)



finalize
protected void finalize()(Code)
Flushes and then closes the debug file.



getInstance
public static synchronized Debug getInstance(String debugName)(Code)
Gets an existing instance of Debug for the specified debug file or a new one if no such instance already exists.



getState
public int getState()(Code)
Returns one of the five possible values:

Debug.OFF

Debug.ERROR

Debug.WARNING

Debug.MESSAGE

Debug.ON




message
public void message(String msg)(Code)
Prints messages only when the debug state is either DEBUG.MESSAGE or Debug.ON.

NOTE: Debugging is an IO intensive operation and may hurt application performance when abused. Particularly, note that Java evaluates arguments to message() even when debugging is turned off. It is recommended that the debug state be checked by invoking messageEnabled() before invoking any message() methods to avoid unnecessary argument evaluation and maximize application performance.


See Also:   Debug.message(String msgThrowable t)



message
public void message(String msg, Throwable t)(Code)

Prints debug and exception messages only when the debug state is either DEBUG.MESSAGE or Debug.ON. If the debug file is not accessible and debugging is enabled, the message along with a timestamp and thread info will be printed on System.out.

This method creates the debug file if does not exist; otherwise it starts appending to the existing debug file. When invoked for the first time on this object, the method writes a line delimiter of '*'s.

Note that the debug file will remain open until destroy() is invoked. To conserve file resources, you should invoke destroy() explicitly rather than wait for the garbage collector to clean up.

NOTE: Debugging is an IO intensive operation and may hurt application performance when abused. Particularly, note that Java evaluates arguments to message() even when debugging is turned off. It is recommended that the debug state be checked by invoking messageEnabled() before invoking any message() methods to avoid unnecessary argument evaluation and to maximize application performance.


Parameters:
  msg - message to be printed. A newline will be appended to themessage before printing either to System.out orto the debug file. If msg is null, it isignored.
Parameters:
  t - Throwable, on which printStackTrace will beinvoked to print the stack trace. If t is null,it is ignored.
See Also:   Debug.error(String msgThrowable t)



messageEnabled
public boolean messageEnabled()(Code)
Checks if message debugging is enabled.

NOTE: Debugging is an IO intensive operation and may hurt application performance when abused. Particularly, note that Java evaluates arguments to message() even when debugging is turned off. It is recommended that messageEnabled() be called to check the debug state before invoking any message() methods to avoid unnecessary argument evaluation and maximize application performance.

true if message debugging is enabledfalse if message debugging is disabled



setDebug
public void setDebug(int debugType)(Code)
Sets the debug capabilities based on the values of the debugType argument.
Parameters:
  debugType - is any one of five possible values:

Debug.OFF

Debug.ERROR

Debug.WARNING

Debug.MESSAGE

Debug.ON




setDebug
public void setDebug()(Code)
Enables or disables degbugging based on the value of debug attribute, gateway.debug, in the platform config file, /etc/opt/SUNWportal/platform.conf. If the attribute is not defined, debugging is disabled by default.



setDebug
public void setDebug(String debugType)(Code)
Sets the debug capabilities based on the values of the debugType argument.
Parameters:
  debugType - is any one of the following possible values:

off - debugging is disabled

on - all debugging is enabled and written toSystem.out

message - message debugging is enabled and written to thedebug file

warning - warning debugging is enabled and written to thedebug

file

error - error debugging is enabled and written to the debug

file




warning
public void warning(String msg)(Code)
Prints warning messages only when debug level is greater than DEBUG.ERROR.

NOTE: Debugging is an IO intensive operation and may hurt application performance when abused. Particularly, note that Java evaluates arguments to warning() even when debugging is turned off. It is recommended that the debug state be checked by invoking warningEnabled() before invoking any warning() methods to avoid unnecessary argument evaluation and to maximize application performance.


See Also:   Debug.warning(String msgThrowable t)



warning
public void warning(String msg, Throwable t)(Code)
Prints warning messages only when debug level is greater than DEBUG.ERROR.

NOTE: Debugging is an IO intensive operation and may hurt application performance when abused. Particularly, note that Java evaluates arguments to warning() even when debugging is turned off. It is recommended that the debug state be checked by invoking warningEnabled() before invoking any warning() methods to avoid unnecessary argument evaluation and to maximize application performance.

If the debug file is not accessible and debuging is enabled, the message along with a timestamp and thread info will be printed on System.out.

This method creates the debug file if does not exist; otherwise it starts appending to the existing debug file. When invoked for the first time on this object, the method writes a line delimiter of '*'s.

Note that the debug file will remain open until destroy() is invoked. To conserve file resources, you should invoke destroy() explicitly rather than wait for the garbage collector to clean up.


Parameters:
  msg - message to be printed. A newline will be appended to themessage before printing either to System.out orto the debug file. If msg is null, it isignored.
Parameters:
  t - Throwable, on which printStackTrace() will beinvoked to print the stack trace. If t is null,it is ignored.



warningEnabled
public boolean warningEnabled()(Code)
Checks if warning debugging is enabled.

NOTE: Debugging is an IO intensive operation and may hurt application performance when abused. Particularly, note that Java evaluates arguments to warning() even when warning debugging is turned off. It is recommended that warningEnabled() be called to check the debug state before invoking any warning() methods to avoid unnecessary argument evaluation and maximize application performance.

true if warning debugging is enabledfalse if warning debugging is disabled



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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