KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > util > logging > Logger

java.util.logging
Class Logger

java.lang.Object
  extended by java.util.logging.Logger
See Also:
Top Examples, Source Code

public void addHandler(Handler handler)
                throws SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[136]Output logging as XML
By Anonymous on 2005/03/16 05:47:51  Rate
package KickJava.logging; 
  
  
 import java.util.logging.*; 
  
  
 public class LogTest2  
  {  
    private static Logger logger =  
       Logger.getLogger ( "KickJava.logging" ) ; 
  
  
    public static void main ( String argv [  ]  )   
     {  
       Handler fh = null; 
       try 
        {  
          fh = new FileHandler (  
             "KickJavaTest.log",50000,1 ) ;  
        }  
       catch ( Exception e )  
        {  
          e.printStackTrace (  ) ; 
        }  
  
  
       // Don't really need this, since XML  
       // formatting is the default for FileHandlers >  
       fh.setFormatter (  
          new java.util.logging.XMLFormatter (  )  ) ; 
  
  
       Handler ch = new ConsoleHandler (  ) ;  
  
  
       // Don't really need this, since simple  
       // formatting is the default for  
       // ConsoleHandlers 
       ch.setFormatter (  
          new java.util.logging.SimpleFormatter (  )  ) ; 
  
  
  
       // Get an instance of the root logger, 
       // which is the parent of all loggers, 
       // and set the global handlers on it 
       Logger rootLogger = Logger.getLogger ( "" ) ; 
       rootLogger.addHandler ( ch ) ; 
       rootLogger.addHandler ( fh ) ; 
  
  
       // Now use the named logger and... 
  
  
       // log a FINE message 
       logger.fine ( "done" ) ; 
  
  
       // log a INFO message. 
       logger.info ( "doing stuff" ) ; 
  
  
       // log a WARNING    
       logger.log ( Level.WARNING,  
          "something may be wrong" ) ; 
        
       // we can log a WARNING as follows 
       // logger.warning ( "something may be wrong" ) ; 
     }  
  }  
  
  
 


public void config(String msg)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void entering(String sourceClass,
                     String sourceMethod)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void entering(String sourceClass,
                     String sourceMethod,
                     Object param1)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void entering(String sourceClass,
                     String sourceMethod,
                     Object[] params)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void exiting(String sourceClass,
                    String sourceMethod)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void exiting(String sourceClass,
                    String sourceMethod,
                    Object result)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void fine(String msg)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void finer(String msg)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void finest(String msg)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Logger getAnonymousLogger()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Logger getAnonymousLogger(String resourceBundleName)
See Also:
MissingResourceException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Filter getFilter()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Handler[] getHandlers()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Level getLevel()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static Logger getLogger(String name)
See Also:
NullPointerException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[135]Use J2SE built-in logging
By Anonymous on 2004/12/17 04:02:43  Rate
package KickJava.logging; 
  
  
 import java.util.logging.*; 
  
  
 public class LogTest1  
  {  
    private static Logger logger =  
       logger.getLogger ( "KickJava.logging" ) ; 
  
  
    public static void main ( String argv [  ]  )   
     {  
       // log a FINE message 
       logger.fine ( "done" ) ; 
  
  
       // Log a INFO message 
       logger.info ( "doing stuff" ) ; 
  
  
       // log a WARNING 
       logger.log ( Level.WARNING,  
          "something may be wrong" ) ; 
        
       // we can log a WARNING as follows 
       // logger.warning ( "something may  
       // be wrong" ) ; 
     }  
  }  
  
  
 


public static Logger getLogger(String name,
                               String resourceBundleName)
See Also:
NullPointerException, IllegalArgumentException, MissingResourceException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getName()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Logger getParent()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ResourceBundle getResourceBundle()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getResourceBundleName()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean getUseParentHandlers()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static final Logger global
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void info(String msg)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isLoggable(Level level)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void log(Level level,
                String msg)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void log(Level level,
                String msg,
                Object param1)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void log(Level level,
                String msg,
                Object[] params)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void log(Level level,
                String msg,
                Throwable thrown)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void log(LogRecord record)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected Logger(String name,
                 String resourceBundleName)
See Also:
MissingResourceException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void logp(Level level,
                 String sourceClass,
                 String sourceMethod,
                 String msg)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void logp(Level level,
                 String sourceClass,
                 String sourceMethod,
                 String msg,
                 Object param1)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void logp(Level level,
                 String sourceClass,
                 String sourceMethod,
                 String msg,
                 Object[] params)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void logp(Level level,
                 String sourceClass,
                 String sourceMethod,
                 String msg,
                 Throwable thrown)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void logrb(Level level,
                  String sourceClass,
                  String sourceMethod,
                  String bundleName,
                  String msg)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void logrb(Level level,
                  String sourceClass,
                  String sourceMethod,
                  String bundleName,
                  String msg,
                  Object param1)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void logrb(Level level,
                  String sourceClass,
                  String sourceMethod,
                  String bundleName,
                  String msg,
                  Object[] params)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void logrb(Level level,
                  String sourceClass,
                  String sourceMethod,
                  String bundleName,
                  String msg,
                  Throwable thrown)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void removeHandler(Handler handler)
                   throws SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setFilter(Filter newFilter)
               throws SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setLevel(Level newLevel)
              throws SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setParent(Logger parent)
See Also:
SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setUseParentHandlers(boolean useParentHandlers)
See Also:
SecurityException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void severe(String msg)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void throwing(String sourceClass,
                     String sourceMethod,
                     Throwable thrown)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void warning(String msg)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags