Java Doc for LogManager.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.LogManager

LogManager
public class LogManager (Code)
LogManager is used to manage named Loggers and any shared logging properties.

There is one global LogManager instance in the application, which can be obtained by calling the static method LogManager.getLogManager().

All methods on this type can be taken as being thread safe.

The LogManager class can be specified by the "java.util.logging.manager" system property. If the property is unavailable or invalid java.util.logging.LogManager will be used by default.

On initialization, LogManager reads its configuration data from a properties file, which by default is the "lib/logging.properties" file in the JRE directory.

However, two system properties can be used instead to customize the initialization of the LogManager:

  • "java.util.logging.config.class"
  • "java.util.logging.config.file"

These properties can be set either by using the Preferences API, as a command line option or by passing the appropriate system property definitions to JNI_CreateJavaVM.

The "java.util.logging.config.class" property should specify a class name. If it is set, this class will be loaded and instantiated during LogManager's initialization, so that this object's default constructor can read the initial configuration and define properties for the LogManager.

The "java.util.logging.config.file" system property can be used to specify a properties file if the "java.util.logging.config.class" property has not been used. This file will be read instead of the default properties file.

Some global logging properties are as follows:

  • "handlers" - a list of handler classes, separated by whitespace. These classes must be subclasses of Handler and must have a public no-argument constructor. They will be registered with the root Logger.
  • "config" - a list of configuration classes, separated by whitespace. These classes should also have a public no-argument default constructor, which should contain all the code for applying that configuration to the logging system.

Besides global properties, properties for individual Loggers and Handlers can be specified in the property files. The names of these properties will start with the fully qualified name of the handler or logger.

The LogManager organizes Loggers based on their fully qualified names. For example, "x.y.z" is child of "x.y".

Levels for Loggers can be defined by properties whose name end with ".level". For example, "alogger.level = 4" sets the level for the logger "alogger" to 4, Any children of "alogger" will also be given the level 4 unless specified lower down in the properties file. The property ".level" will set the log level for the root logger.



Field Summary
final public static  StringLOGGING_MXBEAN_NAME
    

The String value of the LoggingMXBean 's ObjectName.

static  LogManagermanager
    

Constructor Summary
protected  LogManager()
     Default constructor.

Method Summary
public synchronized  booleanaddLogger(Logger logger)
     Add a given logger into the hierarchical namespace.
public  voidaddPropertyChangeListener(PropertyChangeListener l)
     Add a PropertyChangeListener, which will be invoked when the properties are reread.
public  voidcheckAccess()
     Check that the caller has LoggingPermission("control") so that it is trusted to modify the configuration for logging framework.
static  ObjectgetInstanceByClass(String className)
    
public static  LogManagergetLogManager()
    
public synchronized  LoggergetLogger(String name)
    
public synchronized  Enumeration<String>getLoggerNames()
    
public static  LoggingMXBeangetLoggingMXBean()
    
static  StringgetPrivilegedSystemProperty(String key)
    
public  StringgetProperty(String name)
    
static  StringgetSystemLineSeparator()
    
public  voidreadConfiguration()
     Re-initialize the properties and configuration.
public  voidreadConfiguration(InputStream ins)
     Re-initialize the properties and configuration from the given InputStream

A PropertyChangeEvent must be fired.

public  voidremovePropertyChangeListener(PropertyChangeListener l)
     Remove a PropertyChangeListener, do nothing if the given listener is not found.
public  voidreset()
     Reset configuration.

All handlers are closed and removed from any named loggers.


Field Detail
LOGGING_MXBEAN_NAME
final public static String LOGGING_MXBEAN_NAME(Code)

The String value of the LoggingMXBean 's ObjectName.




manager
static LogManager manager(Code)




Constructor Detail
LogManager
protected LogManager()(Code)
Default constructor. This is not public because there should be only one LogManager instance, which can be get by LogManager.getLogManager(. This is protected so that application can subclass the object.




Method Detail
addLogger
public synchronized boolean addLogger(Logger logger)(Code)
Add a given logger into the hierarchical namespace. The Logger.addLogger() factory methods call this method to add newly created Logger. This returns false if a logger with the given name has existed in the namespace

Note that the LogManager may only retain weak references to registered loggers. In order to prevent Logger objects from being unexpectedly garbage collected it is necessary for applications to maintain references to them.


Parameters:
  logger - the logger to be added true if the given logger is added into the namespacesuccessfully, false if the logger of given name has existed inthe namespace



addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener l)(Code)
Add a PropertyChangeListener, which will be invoked when the properties are reread.
Parameters:
  l - the PropertyChangeListener to be added
throws:
  SecurityException - if security manager exists and it determines that caller doesnot have the required permissions to perform this action



checkAccess
public void checkAccess()(Code)
Check that the caller has LoggingPermission("control") so that it is trusted to modify the configuration for logging framework. If the check passes, just return, otherwise SecurityException will be thrown.
throws:
  SecurityException - if there is a security manager in operation and the invokerof this method does not have the required security permissionLoggingPermission("control")



getInstanceByClass
static Object getInstanceByClass(String className)(Code)



getLogManager
public static LogManager getLogManager()(Code)
Get the global LogManager instance the global LogManager instance



getLogger
public synchronized Logger getLogger(String name)(Code)
Get the logger with the given name
Parameters:
  name - name of logger logger with given name, or null if nothing is found



getLoggerNames
public synchronized Enumeration<String> getLoggerNames()(Code)
Get a Enumeration of all registered logger names enumeration of registered logger names



getLoggingMXBean
public static LoggingMXBean getLoggingMXBean()(Code)
Get the LoggingMXBean instance the LoggingMXBean instance



getPrivilegedSystemProperty
static String getPrivilegedSystemProperty(String key)(Code)



getProperty
public String getProperty(String name)(Code)
Get the value of property with given name
Parameters:
  name - the name of property the value of property



getSystemLineSeparator
static String getSystemLineSeparator()(Code)



readConfiguration
public void readConfiguration() throws IOException(Code)
Re-initialize the properties and configuration. The initialization process is same as the LogManager instantiation.

A PropertyChangeEvent must be fired.


throws:
  IOException - if any IO related problems happened
throws:
  SecurityException - if security manager exists and it determines that caller doesnot have the required permissions to perform this action



readConfiguration
public void readConfiguration(InputStream ins) throws IOException(Code)
Re-initialize the properties and configuration from the given InputStream

A PropertyChangeEvent must be fired.


Parameters:
  ins - the input stream.
throws:
  IOException - if any IO related problems happened
throws:
  SecurityException - if security manager exists and it determines that caller doesnot have the required permissions to perform this action



removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener l)(Code)
Remove a PropertyChangeListener, do nothing if the given listener is not found.
Parameters:
  l - the PropertyChangeListener to be removed
throws:
  SecurityException - if security manager exists and it determines that caller doesnot have the required permissions to perform this action



reset
public void reset()(Code)
Reset configuration.

All handlers are closed and removed from any named loggers. All loggers' level is set to null, except the root logger's level is set to Level.INFO.


throws:
  SecurityException - if security manager exists and it determines that caller doesnot have the required permissions to perform this action



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.