Java Doc for Log.java in  » Ajax » zk » org » zkoss » util » logging » 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 » Ajax » zk » org.zkoss.util.logging 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.zkoss.util.logging.Log

Log
public class Log (Code)
The I3 logger. Usage:

private static final Log log = Log.lookup(MyClass.class);
...
if (log.debugable()) log.debug("the information to log:"+some);

Log is designed to minimize the memory usage by avoiding unnecessary allocation of java.util.logging.Logger. In additions, it is possible to use different logger, e.g., log4j, without affecting the client codes.

Since this object is very light-weight, it is OK to have the following statement without using it.
private static final Log log = Log.lookup(MyClass.class);

To log error or warning, simple use the error and warning method.

To log info, depending on the complexity you might want to test infoable first.

log.info("a simple info");
 if (log.infoable())
 log.info(a + complex + string + operation);

To log debug information, we usually also test with D.

log.debug("a simple info");
 if (D.ON && log.debugable())
 log.debug(a + complex + string + operation);

There is a special level called FINER whose priority is lower than DEBUG. It is generally used to log massive debug message under certain situation. In other words, it is suggested to use the debug methods to log messages as follows:

if (log.finerable()) {
 ... do massive testing and/or printing (use finer)
 }

author:
   tomyeh


Field Summary
final public static  LevelALL
     All levels.
final public static  LevelDEBUG
     The DEBUG level.
final public static  LevelERROR
     The ERROR level.
final public static  LevelFINER
     The FINER level.
final public static  LevelINFO
     The INFO level.
final public static  LevelOFF
     The OFF level used to turn of the logging.
final public static  LevelWARNING
     The WARNING level.

Constructor Summary
protected  Log(String name)
     The constructor.

Method Summary
final public  voiddebug(String msg, Throwable t)
     Logs a debug message and a throwable object.
final public  voiddebug(String msg)
     Logs a debug message.
final public  voiddebug(Object obj, Throwable t)
     Logs an object, whose toString returns the debug message, and a throwable object.
final public  voiddebug(Object obj)
     Logs an object, whose toString returns the debug message.
final public  voiddebug(Throwable t)
     Logs a debug throwable object.
final public  voiddebug(int code, Object[] fmtArgs, Throwable t)
     Logs a debug message and a throwable object by giving message code.
final public  voiddebug(int code, Object fmtArg, Throwable t)
     Logs a debug message and a throwable object by giving message code.
final public  voiddebug(int code, Throwable t)
     Logs a debug message and a throwable object by giving message code.
final public  voiddebug(int code, Object[] fmtArgs)
     Logs a debug message by giving message code.
final public  voiddebug(int code, Object fmtArg)
     Logs a debug message by giving message code.
final public  voiddebug(int code)
     Logs a debug message by giving message code.
final public  booleandebugable()
     Tests whether the Log.DEBUG level is loggable.
final public  voideat(String message, Throwable ex)
     Logs an exception as an warning message about being eaten (rather than thrown).
final public  voideat(Throwable ex)
     Logs an exception as an warning message about being eaten (rather than thrown).
public  booleanequals(Object o)
    
final public  voiderror(String msg, Throwable t)
     Logs an error message and a throwable object.
final public  voiderror(String msg)
     Logs an error message.
final public  voiderror(Object obj, Throwable t)
     Logs an object, whose toString returns the error message, and a throwable object.
final public  voiderror(Object obj)
     Logs an object, whose toString returns the error message.
final public  voiderror(Throwable t)
     Logs an error throwable object.
final public  voiderror(int code, Object[] fmtArgs, Throwable t)
     Logs an error message and a throwable object by giving message code.
final public  voiderror(int code, Object fmtArg, Throwable t)
     Logs an error message and a throwable object by giving message code.
final public  voiderror(int code, Throwable t)
     Logs an error message and a throwable object by giving message code.
final public  voiderror(int code, Object[] fmtArgs)
     Logs an error message by giving message code.
final public  voiderror(int code, Object fmtArg)
     Logs an error message by giving message code.
final public  voiderror(int code)
     Logs an error message by giving message code.
final public  voidfiner(String msg, Throwable t)
     Logs a finer message and a throwable object.
final public  voidfiner(String msg)
     Logs a finer message.
final public  voidfiner(Object obj, Throwable t)
     Logs an object, whose toString returns the finer message, and a throwable object.
final public  voidfiner(Object obj)
     Logs an object, whose toString returns the finer message.
final public  voidfiner(Throwable t)
     Logs a finer throwable object.
final public  voidfiner(int code, Object[] fmtArgs, Throwable t)
     Logs a finer message and a throwable object by giving message code.
final public  voidfiner(int code, Object fmtArg, Throwable t)
     Logs a finer message and a throwable object by giving message code.
final public  voidfiner(int code, Throwable t)
     Logs a finer message and a throwable object by giving message code.
final public  voidfiner(int code, Object[] fmtArgs)
     Logs a finer message by giving message code.
final public  voidfiner(int code, Object fmtArg)
     Logs a finer message by giving message code.
final public  voidfiner(int code)
     Logs a finer message by giving message code.
final public  booleanfinerable()
     Tests whether the Log.FINER level is loggable.
final public  LevelgetLevel()
     Retruns the logging level.
final public static  LevelgetLevel(String level)
     Return the logging level of the specified string.
final public  StringgetName()
     Returns the name of this logger.
public  inthashCode()
    
final public  voidinfo(String msg, Throwable t)
     Logs an info message and a throwable object.
final public  voidinfo(String msg)
     Logs an info message.
final public  voidinfo(Object obj, Throwable t)
     Logs an object, whose toString returns the info message, and a throwable object.
final public  voidinfo(Object obj)
     Logs an object, whose toString returns the info message.
final public  voidinfo(Throwable t)
     Logs an info throwable object.
final public  voidinfo(int code, Object[] fmtArgs, Throwable t)
     Logs an info message and a throwable object by giving message code.
final public  voidinfo(int code, Object fmtArg, Throwable t)
     Logs an info message and a throwable object by giving message code.
final public  voidinfo(int code, Throwable t)
     Logs an info message and a throwable object by giving message code.
final public  voidinfo(int code, Object[] fmtArgs)
     Logs an info message by giving message code.
final public  voidinfo(int code, Object fmtArg)
     Logs an info message by giving message code.
final public  voidinfo(int code)
     Logs an info message by giving message code.
final public  booleaninfoable()
     Tests whether the Log.INFO level is loggable.
final public static  booleanisHierarchy()
     Returns whether the loggers support hierarchy. If hierarchy is supported, a Log instance is mapped to a Logger instance with the same name.
final public  voidlog(Level level, String msg, Throwable t)
     Logs a message and a throwable object at the giving level.
final public  voidlog(Level level, Object obj, Throwable t)
     Logs any object and a throwable object at the giving level.
final public  voidlog(Level level, int code, Object[] fmtArgs, Throwable t)
     Logs a message and a throwable object at the giving level by giving a message code and multiple format arguments.
final public  voidlog(Level level, int code, Object fmtArg, Throwable t)
     Logs a message and a throwable object at the giving level by giving a message code and ONE format argument.
final public  voidlog(Level level, int code, Throwable t)
     Logs a message and a throwable object at the giving level by giving a message code and NO format argument.
final public static  Loglookup(Class cls)
     Gets the I3 logger based on the class.
final public static  Loglookup(String name)
     Gets the I3 logger based on the giving name.
final public static  Loglookup(Package pkg)
     Gets the I3 logger based on the package.
final public  voidrealCause(Throwable ex)
     Logs only the real cause of the specified exception.
final public  voidrealCause(String message, Throwable ex)
     Logs only the real cause of the specified exception with an extra message as an error message.
final public  voidrealCauseBriefly(String message, Throwable ex)
     Logs only the first few lines of the real cause as an error message.
final public  voidrealCauseBriefly(Throwable ex)
     Lo only the first few lines of the real cause as an error message.
final public static  voidsetHierarchy(boolean hierarchy)
     Sets whether to support the hierarchical loggers.
final public  voidsetLevel(Level level)
     Sets the logging level.
public  StringtoString()
    
final public  voidwarning(String msg, Throwable t)
     Logs a warning message and a throwable object.
final public  voidwarning(String msg)
     Logs a warning message.
final public  voidwarning(Object obj, Throwable t)
     Logs an object, whose toString returns the warning message, and a throwable object.
final public  voidwarning(Object obj)
     Logs an object, whose toString returns the warning message.
final public  voidwarning(Throwable t)
     Logs a warning throwable object.
final public  voidwarning(int code, Object[] fmtArgs, Throwable t)
     Logs a warning message and a throwable object by giving message code.
final public  voidwarning(int code, Object fmtArg, Throwable t)
     Logs a warning message and a throwable object by giving message code.
final public  voidwarning(int code, Throwable t)
     Logs a warning message and a throwable object by giving message code.
final public  voidwarning(int code, Object[] fmtArgs)
     Logs a warning message by giving message code.
final public  voidwarning(int code, Object fmtArg)
     Logs a warning message by giving message code.
final public  voidwarning(int code)
     Logs a warning message by giving message code.
final public  voidwarningBriefly(String message, Throwable ex)
     Logs only the first few lines of the real cause as an warning message.
final public  voidwarningBriefly(Throwable ex)
     Lo only the first few lines of the real cause.
final public  booleanwarningable()
     Tests whether the Log.WARNING level is loggable.

Field Detail
ALL
final public static Level ALL(Code)
All levels.



DEBUG
final public static Level DEBUG(Code)
The DEBUG level.



ERROR
final public static Level ERROR(Code)
The ERROR level.



FINER
final public static Level FINER(Code)
The FINER level.



INFO
final public static Level INFO(Code)
The INFO level.



OFF
final public static Level OFF(Code)
The OFF level used to turn of the logging.



WARNING
final public static Level WARNING(Code)
The WARNING level.




Constructor Detail
Log
protected Log(String name)(Code)
The constructor.




Method Detail
debug
final public void debug(String msg, Throwable t)(Code)
Logs a debug message and a throwable object.

Since debug messages are rarely disabled, there is no method like infoable or debuggable.




debug
final public void debug(String msg)(Code)
Logs a debug message.



debug
final public void debug(Object obj, Throwable t)(Code)
Logs an object, whose toString returns the debug message, and a throwable object.
Parameters:
  obj - the object whose toString method is called to get the message



debug
final public void debug(Object obj)(Code)
Logs an object, whose toString returns the debug message.
Parameters:
  obj - the object whose toString method is called to get the message



debug
final public void debug(Throwable t)(Code)
Logs a debug throwable object.



debug
final public void debug(int code, Object[] fmtArgs, Throwable t)(Code)
Logs a debug message and a throwable object by giving message code.



debug
final public void debug(int code, Object fmtArg, Throwable t)(Code)
Logs a debug message and a throwable object by giving message code.



debug
final public void debug(int code, Throwable t)(Code)
Logs a debug message and a throwable object by giving message code.



debug
final public void debug(int code, Object[] fmtArgs)(Code)
Logs a debug message by giving message code.



debug
final public void debug(int code, Object fmtArg)(Code)
Logs a debug message by giving message code.



debug
final public void debug(int code)(Code)
Logs a debug message by giving message code.



debugable
final public boolean debugable()(Code)
Tests whether the Log.DEBUG level is loggable.



eat
final public void eat(String message, Throwable ex)(Code)
Logs an exception as an warning message about being eaten (rather than thrown).



eat
final public void eat(Throwable ex)(Code)
Logs an exception as an warning message about being eaten (rather than thrown).



equals
public boolean equals(Object o)(Code)



error
final public void error(String msg, Throwable t)(Code)
Logs an error message and a throwable object.

Since error messages hardly happens and are rarely disabled, there is no method like infoable or debuggable.




error
final public void error(String msg)(Code)
Logs an error message.



error
final public void error(Object obj, Throwable t)(Code)
Logs an object, whose toString returns the error message, and a throwable object.
Parameters:
  obj - the object whose toString method is called to get the message



error
final public void error(Object obj)(Code)
Logs an object, whose toString returns the error message.
Parameters:
  obj - the object whose toString method is called to get the message



error
final public void error(Throwable t)(Code)
Logs an error throwable object.



error
final public void error(int code, Object[] fmtArgs, Throwable t)(Code)
Logs an error message and a throwable object by giving message code.



error
final public void error(int code, Object fmtArg, Throwable t)(Code)
Logs an error message and a throwable object by giving message code.



error
final public void error(int code, Throwable t)(Code)
Logs an error message and a throwable object by giving message code.



error
final public void error(int code, Object[] fmtArgs)(Code)
Logs an error message by giving message code.



error
final public void error(int code, Object fmtArg)(Code)
Logs an error message by giving message code.



error
final public void error(int code)(Code)
Logs an error message by giving message code.



finer
final public void finer(String msg, Throwable t)(Code)
Logs a finer message and a throwable object.



finer
final public void finer(String msg)(Code)
Logs a finer message.



finer
final public void finer(Object obj, Throwable t)(Code)
Logs an object, whose toString returns the finer message, and a throwable object.
Parameters:
  obj - the object whose toString method is called to get the message



finer
final public void finer(Object obj)(Code)
Logs an object, whose toString returns the finer message.
Parameters:
  obj - the object whose toString method is called to get the message



finer
final public void finer(Throwable t)(Code)
Logs a finer throwable object.



finer
final public void finer(int code, Object[] fmtArgs, Throwable t)(Code)
Logs a finer message and a throwable object by giving message code.



finer
final public void finer(int code, Object fmtArg, Throwable t)(Code)
Logs a finer message and a throwable object by giving message code.



finer
final public void finer(int code, Throwable t)(Code)
Logs a finer message and a throwable object by giving message code.



finer
final public void finer(int code, Object[] fmtArgs)(Code)
Logs a finer message by giving message code.



finer
final public void finer(int code, Object fmtArg)(Code)
Logs a finer message by giving message code.



finer
final public void finer(int code)(Code)
Logs a finer message by giving message code.



finerable
final public boolean finerable()(Code)
Tests whether the Log.FINER level is loggable.



getLevel
final public Level getLevel()(Code)
Retruns the logging level.



getLevel
final public static Level getLevel(String level)(Code)
Return the logging level of the specified string. the level; null if no match at all



getName
final public String getName()(Code)
Returns the name of this logger.



hashCode
public int hashCode()(Code)



info
final public void info(String msg, Throwable t)(Code)
Logs an info message and a throwable object.

Since info messages are rarely disabled, there is no method like infoable or debuggable.




info
final public void info(String msg)(Code)
Logs an info message.



info
final public void info(Object obj, Throwable t)(Code)
Logs an object, whose toString returns the info message, and a throwable object.
Parameters:
  obj - the object whose toString method is called to get the message



info
final public void info(Object obj)(Code)
Logs an object, whose toString returns the info message.
Parameters:
  obj - the object whose toString method is called to get the message



info
final public void info(Throwable t)(Code)
Logs an info throwable object.



info
final public void info(int code, Object[] fmtArgs, Throwable t)(Code)
Logs an info message and a throwable object by giving message code.



info
final public void info(int code, Object fmtArg, Throwable t)(Code)
Logs an info message and a throwable object by giving message code.



info
final public void info(int code, Throwable t)(Code)
Logs an info message and a throwable object by giving message code.



info
final public void info(int code, Object[] fmtArgs)(Code)
Logs an info message by giving message code.



info
final public void info(int code, Object fmtArg)(Code)
Logs an info message by giving message code.



info
final public void info(int code)(Code)
Logs an info message by giving message code.



infoable
final public boolean infoable()(Code)
Tests whether the Log.INFO level is loggable.



isHierarchy
final public static boolean isHierarchy()(Code)
Returns whether the loggers support hierarchy. If hierarchy is supported, a Log instance is mapped to a Logger instance with the same name. Therefore, it forms the hierarchical relatiionship among Logger instances. It has the best resolution to control which logger to enable.

On the other hand, if the loggers don't support hierarchy, all Log instances are actually mapped to the same Logger called "org.zkoss". The performance is better in this mode.

Default: false.

Note: Once LogService is initialized, Log.setHierarchy is called automatically to turn on the hierarchy support.




log
final public void log(Level level, String msg, Throwable t)(Code)
Logs a message and a throwable object at the giving level.

All log methods eventaully invokes this method to log messages.
Parameters:
  t - the throwable object; null to ignore




log
final public void log(Level level, Object obj, Throwable t)(Code)
Logs any object and a throwable object at the giving level.
Parameters:
  obj - the object whose toString method is called to get the message



log
final public void log(Level level, int code, Object[] fmtArgs, Throwable t)(Code)
Logs a message and a throwable object at the giving level by giving a message code and multiple format arguments.
Parameters:
  t - the throwable object; null to ignore



log
final public void log(Level level, int code, Object fmtArg, Throwable t)(Code)
Logs a message and a throwable object at the giving level by giving a message code and ONE format argument.
Parameters:
  t - the throwable object; null to ignore



log
final public void log(Level level, int code, Throwable t)(Code)
Logs a message and a throwable object at the giving level by giving a message code and NO format argument.
Parameters:
  t - the throwable object; null to ignore



lookup
final public static Log lookup(Class cls)(Code)
Gets the I3 logger based on the class.
Parameters:
  cls - the class that identifies the logger.



lookup
final public static Log lookup(String name)(Code)
Gets the I3 logger based on the giving name.



lookup
final public static Log lookup(Package pkg)(Code)
Gets the I3 logger based on the package.



realCause
final public void realCause(Throwable ex)(Code)
Logs only the real cause of the specified exception. It is useful because sometimes the stack trace is too big.



realCause
final public void realCause(String message, Throwable ex)(Code)
Logs only the real cause of the specified exception with an extra message as an error message.



realCauseBriefly
final public void realCauseBriefly(String message, Throwable ex)(Code)
Logs only the first few lines of the real cause as an error message.



realCauseBriefly
final public void realCauseBriefly(Throwable ex)(Code)
Lo only the first few lines of the real cause as an error message.



setHierarchy
final public static void setHierarchy(boolean hierarchy)(Code)
Sets whether to support the hierarchical loggers.



setLevel
final public void setLevel(Level level)(Code)
Sets the logging level.



toString
public String toString()(Code)



warning
final public void warning(String msg, Throwable t)(Code)
Logs a warning message and a throwable object.

Since warning messages are rarely disabled, there is no method like infoable or debuggable.




warning
final public void warning(String msg)(Code)
Logs a warning message.



warning
final public void warning(Object obj, Throwable t)(Code)
Logs an object, whose toString returns the warning message, and a throwable object.
Parameters:
  obj - the object whose toString method is called to get the message



warning
final public void warning(Object obj)(Code)
Logs an object, whose toString returns the warning message.
Parameters:
  obj - the object whose toString method is called to get the message



warning
final public void warning(Throwable t)(Code)
Logs a warning throwable object.



warning
final public void warning(int code, Object[] fmtArgs, Throwable t)(Code)
Logs a warning message and a throwable object by giving message code.



warning
final public void warning(int code, Object fmtArg, Throwable t)(Code)
Logs a warning message and a throwable object by giving message code.



warning
final public void warning(int code, Throwable t)(Code)
Logs a warning message and a throwable object by giving message code.



warning
final public void warning(int code, Object[] fmtArgs)(Code)
Logs a warning message by giving message code.



warning
final public void warning(int code, Object fmtArg)(Code)
Logs a warning message by giving message code.



warning
final public void warning(int code)(Code)
Logs a warning message by giving message code.



warningBriefly
final public void warningBriefly(String message, Throwable ex)(Code)
Logs only the first few lines of the real cause as an warning message.



warningBriefly
final public void warningBriefly(Throwable ex)(Code)
Lo only the first few lines of the real cause.



warningable
final public boolean warningable()(Code)
Tests whether the Log.WARNING level is loggable.



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.