Java Doc for Logger.java in  » Apache-Harmony-Java-SE » java-package » java » 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 » Apache Harmony Java SE » java package » java.util.logging 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.logging.Logger

Logger
public class Logger (Code)
Loggers are used to log records to certain outputs, including file, console, etc. They use various handlers to actually do the output-dependent operations.

Client applications can get named loggers by calling the methods getLogger. They can also get anonymous loggers by calling the methods getAnonymousLogger. Named loggers are organized in a namespace hierarchy managed by a log manager. The naming convention is usually the same as java package's naming convention, i.e., using dot-separated strings. Anonymous loggers do not belong to any namespace.

Loggers "inherit" log level setting from their parent if its own level is set to null. This is also true for the resource bundle. The logger's resource bundle is used to localize the log messages if no resource bundle name is given when a log method is called. If getUseParentHandlers is true, loggers also inherit their parent's handlers. Here "inherit" only means the "behaviors" are inherited. The internal fields value will not change, for example, getLevel() still returns null.

When loading a given resource bundle, the logger first tries to use the context classloader. If that fails, it tries the system classloader. And if that still fails, it searches up the class stack and uses each class's classloader to try to locate the resource bundle.

Some log methods accept log requests that do not specify the source class and source method. In these cases, the logging framework will automatically infer the calling class and method, but not guaranteed to be accurate.

Once a LogRecord object has been passed into the logging framework, it is owned by the logging framework and the client applications should not use it any longer.

All methods of this class are thread-safe.


See Also:   LogManager

Inner Class :static class PrivateSecurityManager extends SecurityManager

Field Summary
final public static  Loggerglobal
     The global logger is provided as convenience for casual use.

Constructor Summary
protected  Logger(String name, String resourceBundleName)
     Constructs a Logger object with the supplied name and resource bundle name.

Method Summary
final  voidaddChild(Logger logger)
    
public  voidaddHandler(Handler handler)
     Adds a handler to this logger.
public  voidconfig(String msg)
     Logs a message of level Level.CONFIG.
public  voidentering(String sourceClass, String sourceMethod)
     Logs a message indicating entering a method.
public  voidentering(String sourceClass, String sourceMethod, Object param)
     Logs a message indicating entering a method.
public  voidentering(String sourceClass, String sourceMethod, Object[] params)
     Logs a message indicating entering a method.
public  voidexiting(String sourceClass, String sourceMethod)
     Logs a message indicating existing a method.
public  voidexiting(String sourceClass, String sourceMethod, Object result)
     Logs a message indicating exiting a method.
public  voidfine(String msg)
     Logs a message of level Level.FINE.
public  voidfiner(String msg)
     Logs a message of level Level.FINER.
public  voidfinest(String msg)
     Logs a message of level Level.FINEST.
public static  LoggergetAnonymousLogger()
     Gets an anonymous logger to use internally in a thread.
public static  LoggergetAnonymousLogger(String resourceBundleName)
     Gets an anonymous logger to use internally in a thread.
public  FiltergetFilter()
     Gets the filter used by this logger.
public  Handler[]getHandlers()
     Gets all the handlers associated with this logger.
public  LevelgetLevel()
     Gets the logging level of this logger.
public static  LoggergetLogger(String name)
     Gets a named logger.
public static  LoggergetLogger(String name, String resourceBundleName)
     Gets a named logger associated with the supplied resource bundle.
public  StringgetName()
     Gets the name of this logger.
public  LoggergetParent()
     Gets the parent of this logger in the namespace.
public  ResourceBundlegetResourceBundle()
     Gets the loaded resource bundle used by this logger to localize logging messages.
public  StringgetResourceBundleName()
     Gets the name of the loaded resource bundle used by this logger to localize logging messages.
public  booleangetUseParentHandlers()
     Gets the flag which indicates whether to use parent's handlers to publish incoming log records, potentially recursively up the namespace.
public  voidinfo(String msg)
     Logs a message of level Level.INFO.
 voidinternalSetParent(Logger newParent)
     Sets the parent of this logger in the namespace.
public  booleanisLoggable(Level l)
     Determines whether this logger will actually log messages of the specified level.
static  ResourceBundleloadResourceBundle(String resourceBundleName)
     Load the specified resource bundle, use privileged code.
public  voidlog(Level logLevel, String msg)
     Logs a message of the specified level.
public  voidlog(Level logLevel, String msg, Object param)
     Logs a message of the specified level with the supplied parameter.
public  voidlog(Level logLevel, String msg, Object[] params)
     Logs a message of the specified level with the supplied parameter array.
public  voidlog(Level logLevel, String msg, Throwable thrown)
     Logs a message of the specified level with the supplied Throwable object.
public  voidlog(LogRecord record)
     Logs a given log record.
public  voidlogp(Level logLevel, String sourceClass, String sourceMethod, String msg)
     Logs a message of the given level with the specified source class name and source method name.
public  voidlogp(Level logLevel, String sourceClass, String sourceMethod, String msg, Object param)
     Logs a message of the given level with the specified source class name and source method name and parameter.
public  voidlogp(Level logLevel, String sourceClass, String sourceMethod, String msg, Object[] params)
     Logs a message of the given level with the specified source class name and source method name and parameter array.
public  voidlogp(Level logLevel, String sourceClass, String sourceMethod, String msg, Throwable thrown)
     Logs a message of the given level with the specified source class name and source method name and Throwable object.
public  voidlogrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg)
     Logs a message of the given level with the specified source class name and source method name, using the given resource bundle to localize the message.
public  voidlogrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg, Object param)
     Logs a message of the given level with the specified source class name and source method name and parameter, using the given resource bundle to localize the message.
public  voidlogrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg, Object[] params)
     Logs a message of the given level with the specified source class name and source method name and parameter array, using the given resource bundle to localize the message.
public  voidlogrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg, Throwable thrown)
     Logs a message of the given level with the specified source class name and source method name and Throwable object, using the given resource bundle to localize the message.
final  voidremoveChild(Logger child)
    
public  voidremoveHandler(Handler handler)
     Removes a handler for this logger.
synchronized  voidreset()
    
public  voidsetFilter(Filter newFilter)
     Sets the filter used by this logger.
public  voidsetLevel(Level newLevel)
     Sets the logging level for this logger.
 voidsetManager(LogManager manager)
    
public  voidsetParent(Logger parent)
     Sets the parent of this logger in the namespace.
public  voidsetUseParentHandlers(boolean notifyParentHandlers)
     Sets the flag which indicates whether to use parent's handlers to publish incoming log records, potentially recursively up the namespace.
public  voidsevere(String msg)
     Logs a message of level Level.SEVERE.
public  voidthrowing(String sourceClass, String sourceMethod, Throwable thrown)
     Logs a message indicating throwing an exception.
public  voidwarning(String msg)
     Logs a message of level Level.WARNING.

Field Detail
global
final public static Logger global(Code)
The global logger is provided as convenience for casual use.




Constructor Detail
Logger
protected Logger(String name, String resourceBundleName)(Code)
Constructs a Logger object with the supplied name and resource bundle name.
Parameters:
  name - the name of this logger, may be null for anonymous loggers
Parameters:
  resourceBundleName - the name of the resource bundle used to localize loggingmessages, may be null
throws:
  MissingResourceException - If the specified resource bundle can not be loaded.




Method Detail
addChild
final void addChild(Logger logger)(Code)



addHandler
public void addHandler(Handler handler)(Code)
Adds a handler to this logger. The handler will be fed with log records received by this logger.
Parameters:
  handler - the handler object to add, cannot be null
throws:
  SecurityException - If a security manager determines that the caller does nothave the required permission.



config
public void config(String msg)(Code)
Logs a message of level Level.CONFIG.
Parameters:
  msg - the message to log



entering
public void entering(String sourceClass, String sourceMethod)(Code)
Logs a message indicating entering a method. A log record with log level Level.FINER, log message "ENTRY", and the specified source class name and source method name is submitted for logging.
Parameters:
  sourceClass - the calling class name
Parameters:
  sourceMethod - the method name



entering
public void entering(String sourceClass, String sourceMethod, Object param)(Code)
Logs a message indicating entering a method. A log record with log level Level.FINER, log message "ENTRY", and the specified source class name and source method name and one parameter is submitted for logging.
Parameters:
  sourceClass - the source class name
Parameters:
  sourceMethod - the source method name
Parameters:
  param - the parameter for the method call



entering
public void entering(String sourceClass, String sourceMethod, Object[] params)(Code)
Logs a message indicating entering a method. A log record with log level Level.FINER, log message "ENTRY", and the specified source class name and source method name and parameters is submitted for logging.
Parameters:
  sourceClass - the source class name
Parameters:
  sourceMethod - the source method name
Parameters:
  params - an array of parameters for the method call



exiting
public void exiting(String sourceClass, String sourceMethod)(Code)
Logs a message indicating existing a method. A log record with log level Level.FINER, log message "RETURN", and the specified source class name and source method name is submitted for logging.
Parameters:
  sourceClass - the calling class name
Parameters:
  sourceMethod - the method name



exiting
public void exiting(String sourceClass, String sourceMethod, Object result)(Code)
Logs a message indicating exiting a method. A log record with log level Level.FINER, log message "RETURN", and the specified source class name and source method name and return value is submitted for logging.
Parameters:
  sourceClass - the source class name
Parameters:
  sourceMethod - the source method name
Parameters:
  result - the return value of the method call



fine
public void fine(String msg)(Code)
Logs a message of level Level.FINE.
Parameters:
  msg - the message to log



finer
public void finer(String msg)(Code)
Logs a message of level Level.FINER.
Parameters:
  msg - the message to log



finest
public void finest(String msg)(Code)
Logs a message of level Level.FINEST.
Parameters:
  msg - the message to log



getAnonymousLogger
public static Logger getAnonymousLogger()(Code)
Gets an anonymous logger to use internally in a thread. Anonymous loggers are not registered in the log manager's namespace. No security checks will be performed when updating an anonymous logger's control settings so that they can be used in applets.

Anonymous loggers' parent is set to be the root logger. This enables them to inherit default logging level and handlers from the root logger.

a new instance of anonymous logger



getAnonymousLogger
public static Logger getAnonymousLogger(String resourceBundleName)(Code)
Gets an anonymous logger to use internally in a thread. Anonymous loggers are not registered in the log manager's namespace. No security checks will be performed when updating an anonymous logger's control settings so that they can be used in applets.

Anonymous loggers' parent is set to be the root logger. This enables them to inherit default logging level and handlers from the root logger.


Parameters:
  resourceBundleName - the name of the resource bundle used to localize log messages a new instance of anonymous logger
throws:
  MissingResourceException - If the specified resource bundle can not be loaded.



getFilter
public Filter getFilter()(Code)
Gets the filter used by this logger. the filter used by this logger



getHandlers
public Handler[] getHandlers()(Code)
Gets all the handlers associated with this logger. an array of all the handlers associated with this logger



getLevel
public Level getLevel()(Code)
Gets the logging level of this logger. the logging level of this logger



getLogger
public static Logger getLogger(String name)(Code)
Gets a named logger. The returned logger may already exist, or may be newly created. If the latter, its level will be set to the configured level according to the LogManager's properties if any.
Parameters:
  name - the name of the logger to get, cannot be null a named logger
throws:
  MissingResourceException - If the specified resource bundle can not be loaded.



getLogger
public static Logger getLogger(String name, String resourceBundleName)(Code)
Gets a named logger associated with the supplied resource bundle. The resource bundle will be used to localize logging messages.
Parameters:
  name - the name of the logger to get, cannot be null
Parameters:
  resourceBundleName - the name of the resource bundle, may be null a named logger



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



getParent
public Logger getParent()(Code)
Gets the parent of this logger in the namespace. the parent of this logger in the namespace



getResourceBundle
public ResourceBundle getResourceBundle()(Code)
Gets the loaded resource bundle used by this logger to localize logging messages. If it's null, the parent's resource bundle will be inherited. the loaded resource bundle used by this logger



getResourceBundleName
public String getResourceBundleName()(Code)
Gets the name of the loaded resource bundle used by this logger to localize logging messages. If it's null, the parent's resource bundle name will be inherited. the name of the loaded resource bundle used by this logger



getUseParentHandlers
public boolean getUseParentHandlers()(Code)
Gets the flag which indicates whether to use parent's handlers to publish incoming log records, potentially recursively up the namespace. true if set to use parent's handlers, otherwisefalse



info
public void info(String msg)(Code)
Logs a message of level Level.INFO.
Parameters:
  msg - the message to log



internalSetParent
void internalSetParent(Logger newParent)(Code)
Sets the parent of this logger in the namespace. This method should usually be used by the LogManager object only. This method does not check security.
Parameters:
  newParent - the parent logger to set



isLoggable
public boolean isLoggable(Level l)(Code)
Determines whether this logger will actually log messages of the specified level. The effective level used to do the determination may be inherited from its parent. The default level is Level.INFO.
Parameters:
  l - the level to check true if this logger will actually log this level,otherwise false



loadResourceBundle
static ResourceBundle loadResourceBundle(String resourceBundleName)(Code)
Load the specified resource bundle, use privileged code.
Parameters:
  resourceBundleName - the name of the resource bundle to load, cannot be null the loaded resource bundle.
throws:
  MissingResourceException - If the specified resource bundle can not be loaded.



log
public void log(Level logLevel, String msg)(Code)
Logs a message of the specified level.
Parameters:
  logLevel - the level of the given message
Parameters:
  msg - the message to log



log
public void log(Level logLevel, String msg, Object param)(Code)
Logs a message of the specified level with the supplied parameter.
Parameters:
  logLevel - the level of the given message
Parameters:
  msg - the message to log
Parameters:
  param - the parameter associated with the event that need to be logged



log
public void log(Level logLevel, String msg, Object[] params)(Code)
Logs a message of the specified level with the supplied parameter array.
Parameters:
  logLevel - the level of the given message
Parameters:
  msg - the message to log
Parameters:
  params - the parameter array associated with the event that need to belogged



log
public void log(Level logLevel, String msg, Throwable thrown)(Code)
Logs a message of the specified level with the supplied Throwable object.
Parameters:
  logLevel - the level of the given message
Parameters:
  msg - the message to log
Parameters:
  thrown - the Throwable object associated with the eventthat need to be logged



log
public void log(LogRecord record)(Code)
Logs a given log record. Only those with a logging level no lower than this logger's level will be submitted to this logger's handlers for logging. If getUseParentHandlers() is true, the log record will also be submitted to the parent logger's handlers, potentially recursively up the namespace.

Since all other log methods call this method to actually perform the logging action, subclasses of this class can override this method to catch all logging activities.


Parameters:
  record - the log record to be logged



logp
public void logp(Level logLevel, String sourceClass, String sourceMethod, String msg)(Code)
Logs a message of the given level with the specified source class name and source method name.
Parameters:
  logLevel - the level of the given message
Parameters:
  sourceClass - the source class name
Parameters:
  sourceMethod - the source method name
Parameters:
  msg - the message to be logged



logp
public void logp(Level logLevel, String sourceClass, String sourceMethod, String msg, Object param)(Code)
Logs a message of the given level with the specified source class name and source method name and parameter.
Parameters:
  logLevel - the level of the given message
Parameters:
  sourceClass - the source class name
Parameters:
  sourceMethod - the source method name
Parameters:
  msg - the message to be logged
Parameters:
  param - the parameter associated with the event that need to be logged



logp
public void logp(Level logLevel, String sourceClass, String sourceMethod, String msg, Object[] params)(Code)
Logs a message of the given level with the specified source class name and source method name and parameter array.
Parameters:
  logLevel - the level of the given message
Parameters:
  sourceClass - the source class name
Parameters:
  sourceMethod - the source method name
Parameters:
  msg - the message to be logged
Parameters:
  params - the parameter array associated with the event that need to belogged



logp
public void logp(Level logLevel, String sourceClass, String sourceMethod, String msg, Throwable thrown)(Code)
Logs a message of the given level with the specified source class name and source method name and Throwable object.
Parameters:
  logLevel - the level of the given message
Parameters:
  sourceClass - the source class name
Parameters:
  sourceMethod - the source method name
Parameters:
  msg - the message to be logged
Parameters:
  thrown - the Throwable object



logrb
public void logrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg)(Code)
Logs a message of the given level with the specified source class name and source method name, using the given resource bundle to localize the message.
Parameters:
  logLevel - the level of the given message
Parameters:
  sourceClass - the source class name
Parameters:
  sourceMethod - the source method name
Parameters:
  bundleName - the name of the resource bundle, used to localize the message
Parameters:
  msg - the message to be logged



logrb
public void logrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg, Object param)(Code)
Logs a message of the given level with the specified source class name and source method name and parameter, using the given resource bundle to localize the message.
Parameters:
  logLevel - the level of the given message
Parameters:
  sourceClass - the source class name
Parameters:
  sourceMethod - the source method name
Parameters:
  bundleName - the name of the resource bundle, used to localize the message
Parameters:
  msg - the message to be logged
Parameters:
  param - the parameter associated with the event that need to be logged



logrb
public void logrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg, Object[] params)(Code)
Logs a message of the given level with the specified source class name and source method name and parameter array, using the given resource bundle to localize the message.
Parameters:
  logLevel - the level of the given message
Parameters:
  sourceClass - the source class name
Parameters:
  sourceMethod - the source method name
Parameters:
  bundleName - the name of the resource bundle, used to localize the message
Parameters:
  msg - the message to be logged
Parameters:
  params - the parameter array associated with the event that need to belogged



logrb
public void logrb(Level logLevel, String sourceClass, String sourceMethod, String bundleName, String msg, Throwable thrown)(Code)
Logs a message of the given level with the specified source class name and source method name and Throwable object, using the given resource bundle to localize the message.
Parameters:
  logLevel - the level of the given message
Parameters:
  sourceClass - the source class name
Parameters:
  sourceMethod - the source method name
Parameters:
  bundleName - the name of the resource bundle, used to localize the message
Parameters:
  msg - the message to be logged
Parameters:
  thrown - the Throwable object



removeChild
final void removeChild(Logger child)(Code)



removeHandler
public void removeHandler(Handler handler)(Code)
Removes a handler for this logger. If the specified handler does not exist, this method has no effect.
Parameters:
  handler - the handler to be removed, cannot be null
throws:
  SecurityException - If a security manager determines that the caller does nothave the required permission.



reset
synchronized void reset()(Code)



setFilter
public void setFilter(Filter newFilter)(Code)
Sets the filter used by this logger.
Parameters:
  newFilter - the filter to set
throws:
  SecurityException - If a security manager determines that the caller does nothave the required permission.



setLevel
public void setLevel(Level newLevel)(Code)
Sets the logging level for this logger. A null level indicates this logger will inherit its parent's level.
Parameters:
  newLevel - the logging level to set
throws:
  SecurityException - If a security manager determines that the caller does nothave the required permission.



setManager
void setManager(LogManager manager)(Code)



setParent
public void setParent(Logger parent)(Code)
Sets the parent of this logger in the namespace. This method should usually be used by the LogManager object only.
Parameters:
  parent - the parent logger to set
throws:
  SecurityException - If a security manager determines that the caller does nothave the required permission.



setUseParentHandlers
public void setUseParentHandlers(boolean notifyParentHandlers)(Code)
Sets the flag which indicates whether to use parent's handlers to publish incoming log records, potentially recursively up the namespace.
Parameters:
  notifyParentHandlers - the flag whether to use parent's handlers
throws:
  SecurityException - If a security manager determines that the caller does nothave the required permission.



severe
public void severe(String msg)(Code)
Logs a message of level Level.SEVERE.
Parameters:
  msg - the message to log



throwing
public void throwing(String sourceClass, String sourceMethod, Throwable thrown)(Code)
Logs a message indicating throwing an exception. A log record with log level Level.FINER, log message "THROW", and the specified source class name and source method name and Throwable object is submitted for logging.
Parameters:
  sourceClass - the source class name
Parameters:
  sourceMethod - the source method name
Parameters:
  thrown - the Throwable object



warning
public void warning(String msg)(Code)
Logs a message of level Level.WARNING.
Parameters:
  msg - the message to log



Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) 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.