Java Doc for Handler.java in  » 6.0-JDK-Core » Collections-Jar-Zip-Logging-regex » java » util » logging » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » Collections Jar Zip Logging regex » java.util.logging 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.logging.Handler

All known Subclasses:   java.util.logging.StreamHandler,  java.util.logging.MemoryHandler,
Handler
abstract public class Handler (Code)
A Handler object takes log messages from a Logger and exports them. It might for example, write them to a console or write them to a file, or send them to a network logging service, or forward them to an OS log, or whatever.

A Handler can be disabled by doing a setLevel(Level.OFF) and can be re-enabled by doing a setLevel with an appropriate level.

Handler classes typically use LogManager properties to set default values for the Handler's Filter, Formatter, and Level. See the specific documentation for each concrete Handler class.
version:
   1.27, 05/05/07
since:
   1.4



Field Summary
 booleansealed
    

Constructor Summary
protected  Handler()
     Default constructor.

Method Summary
 voidcheckAccess()
    
abstract public  voidclose()
     Close the Handler and free all associated resources.

The close method will perform a flush and then close the Handler.

abstract public  voidflush()
     Flush any buffered output.
public  StringgetEncoding()
     Return the character encoding for this Handler. The encoding name.
public  ErrorManagergetErrorManager()
     Retrieves the ErrorManager for this Handler.
public  FiltergetFilter()
     Get the current Filter for this Handler.
public  FormattergetFormatter()
     Return the Formatter for this Handler.
public synchronized  LevelgetLevel()
     Get the log level specifying which messages will be logged by this Handler.
public  booleanisLoggable(LogRecord record)
     Check if this Handler would actually log a given LogRecord.

This method checks if the LogRecord has an appropriate Level and whether it satisfies any Filter.

abstract public  voidpublish(LogRecord record)
     Publish a LogRecord.

The logging request was made initially to a Logger object, which initialized the LogRecord and forwarded it here.

The Handler is responsible for formatting the message, when and if necessary.

protected  voidreportError(String msg, Exception ex, int code)
     Protected convenience method to report an error to this Handler's ErrorManager.
public  voidsetEncoding(String encoding)
     Set the character encoding used by this Handler.
public  voidsetErrorManager(ErrorManager em)
     Define an ErrorManager for this Handler.
public  voidsetFilter(Filter newFilter)
     Set a Filter to control output on this Handler.
public  voidsetFormatter(Formatter newFormatter)
     Set a Formatter.
public synchronized  voidsetLevel(Level newLevel)
     Set the log level specifying which message levels will be logged by this Handler.

Field Detail
sealed
boolean sealed(Code)




Constructor Detail
Handler
protected Handler()(Code)
Default constructor. The resulting Handler has a log level of Level.ALL, no Formatter, and no Filter. A default ErrorManager instance is installed as the ErrorManager.




Method Detail
checkAccess
void checkAccess() throws SecurityException(Code)



close
abstract public void close() throws SecurityException(Code)
Close the Handler and free all associated resources.

The close method will perform a flush and then close the Handler. After close has been called this Handler should no longer be used. Method calls may either be silently ignored or may throw runtime exceptions.
exception:
  SecurityException - if a security manager exists and ifthe caller does not have LoggingPermission("control").




flush
abstract public void flush()(Code)
Flush any buffered output.



getEncoding
public String getEncoding()(Code)
Return the character encoding for this Handler. The encoding name. May be null, which indicates thedefault encoding should be used.



getErrorManager
public ErrorManager getErrorManager()(Code)
Retrieves the ErrorManager for this Handler.
exception:
  SecurityException - if a security manager exists and ifthe caller does not have LoggingPermission("control").



getFilter
public Filter getFilter()(Code)
Get the current Filter for this Handler. a Filter object (may be null)



getFormatter
public Formatter getFormatter()(Code)
Return the Formatter for this Handler. the Formatter (may be null).



getLevel
public synchronized Level getLevel()(Code)
Get the log level specifying which messages will be logged by this Handler. Message levels lower than this level will be discarded. the level of messages being logged.



isLoggable
public boolean isLoggable(LogRecord record)(Code)
Check if this Handler would actually log a given LogRecord.

This method checks if the LogRecord has an appropriate Level and whether it satisfies any Filter. It also may make other Handler specific checks that might prevent a handler from logging the LogRecord. It will return false if the LogRecord is Null.


Parameters:
  record - a LogRecord true if the LogRecord would be logged.




publish
abstract public void publish(LogRecord record)(Code)
Publish a LogRecord.

The logging request was made initially to a Logger object, which initialized the LogRecord and forwarded it here.

The Handler is responsible for formatting the message, when and if necessary. The formatting should include localization.
Parameters:
  record - description of the log event. A null record issilently ignored and is not published




reportError
protected void reportError(String msg, Exception ex, int code)(Code)
Protected convenience method to report an error to this Handler's ErrorManager. Note that this method retrieves and uses the ErrorManager without doing a security check. It can therefore be used in environments where the caller may be non-privileged.
Parameters:
  msg - a descriptive string (may be null)
Parameters:
  ex - an exception (may be null)
Parameters:
  code - an error code defined in ErrorManager



setEncoding
public void setEncoding(String encoding) throws SecurityException, java.io.UnsupportedEncodingException(Code)
Set the character encoding used by this Handler.

The encoding should be set before any LogRecords are written to the Handler.
Parameters:
  encoding - The name of a supported character encoding.May be null, to indicate the default platform encoding.
exception:
  SecurityException - if a security manager exists and ifthe caller does not have LoggingPermission("control").
exception:
  UnsupportedEncodingException - if the named encoding isnot supported.




setErrorManager
public void setErrorManager(ErrorManager em)(Code)
Define an ErrorManager for this Handler.

The ErrorManager's "error" method will be invoked if any errors occur while using this Handler.
Parameters:
  em - the new ErrorManager
exception:
  SecurityException - if a security manager exists and ifthe caller does not have LoggingPermission("control").




setFilter
public void setFilter(Filter newFilter) throws SecurityException(Code)
Set a Filter to control output on this Handler.

For each call of publish the Handler will call this Filter (if it is non-null) to check if the LogRecord should be published or discarded.
Parameters:
  newFilter - a Filter object (may be null)
exception:
  SecurityException - if a security manager exists and ifthe caller does not have LoggingPermission("control").




setFormatter
public void setFormatter(Formatter newFormatter) throws SecurityException(Code)
Set a Formatter. This Formatter will be used to format LogRecords for this Handler.

Some Handlers may not use Formatters, in which case the Formatter will be remembered, but not used.


Parameters:
  newFormatter - the Formatter to use (may not be null)
exception:
  SecurityException - if a security manager exists and ifthe caller does not have LoggingPermission("control").




setLevel
public synchronized void setLevel(Level newLevel) throws SecurityException(Code)
Set the log level specifying which message levels will be logged by this Handler. Message levels lower than this value will be discarded.

The intention is to allow developers to turn on voluminous logging, but to limit the messages that are sent to certain Handlers.
Parameters:
  newLevel - the new value for the log level
exception:
  SecurityException - if a security manager exists and ifthe caller does not have LoggingPermission("control").




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.