Package java.util.logging

Examples of java.util.logging.SimpleFormatter


   * Test publish(), null log record, handler should call ErrorManager to
   * handle exceptional case
   */
  public void testPublish_Null() {
    StreamHandler h = new StreamHandler(new ByteArrayOutputStream(),
        new SimpleFormatter());
    h.publish(null);
  }
View Full Code Here


  /*
   * Test setOutputStream() with null.
   */
  public void testSetOutputStream_null() {
    MockStreamHandler h = new MockStreamHandler(
        new ByteArrayOutputStream(), new SimpleFormatter());
    try {
      h.setOutputStream(null);
      fail("Should throw NullPointerException!");
    } catch (NullPointerException e) {
      // expected
View Full Code Here

  /*
   * @see TestCase#setUp()
   */
  protected void setUp() throws Exception {
    super.setUp();
    sf = new SimpleFormatter();
    lr = new LogRecord(Level.FINE, MSG);
  }
View Full Code Here

        if (formatterName != null) {
            try {
                setFormatter((Formatter) cl.loadClass(formatterName).newInstance());
            } catch (Exception e) {
                // Ignore and fallback to defaults
                setFormatter(new SimpleFormatter());
            }
        } else {
            setFormatter(new SimpleFormatter());
        }
       
        // Set error manager
        setErrorManager(new ErrorManager());
       
View Full Code Here

        if (formatterName != null) {
            try {
                setFormatter((Formatter) cl.loadClass(formatterName).newInstance());
            } catch (Exception e) {
                // Ignore and fallback to defaults
                setFormatter(new SimpleFormatter());
            }
        } else {
            setFormatter(new SimpleFormatter());
        }
       
        // Set error manager
        setErrorManager(new ErrorManager());
       
View Full Code Here

    public static void configureLogger(String path) {
        try{
            file = new FileHandler(path, true);
            logger.addHandler(file);
            logger.setLevel(Level.ALL);
            SimpleFormatter formatter = new SimpleFormatter();
            file.setFormatter(formatter);
        }catch(IOException ioe){
            throw new LoggerException();
        }
    }
View Full Code Here

        getLogger().log(FINE_LEVEL, "*** Adding logFileHandler - " + logFile);
        // already created directory structure for log file, so just add log
        try
        {// todo 6581651
            externalLogfileHandler = new FileHandler(logFile, true);
            externalLogfileHandler.setFormatter(new SimpleFormatter());
            externalLogfileHandler.setLevel(Level.ALL);
            getLogger().addHandler(externalLogfileHandler);
        }
        catch(IOException e)
        {
View Full Code Here

        // Send logger output to our FileHandler.
        getLogger().log(Level.FINE, "*** Adding logFileHandler - " + logFile);
        // already created directory structure for log file, so just add log
        try {
            FileHandler fh = new FileHandler(logFile, true);
            fh.setFormatter(new SimpleFormatter());
            fh.setLevel(Level.ALL);
            getLogger().addHandler(fh);
        } catch(IOException e) {
            // should be seen in verbose mode for debugging
            e.printStackTrace();
View Full Code Here

         *Creates a new instance of the buffered log handler.
         */
        public BufferedHandler() {
            setLevel(Level.ALL);
            setFilter(null);
            setFormatter(new SimpleFormatter());
        }
View Full Code Here

                    }
               
                }
               
                if (defaultFormatter == null) {
                    defaultFormatter = new SimpleFormatter();
                }
               
                try {
                   fileHandler.setFormatter(defaultFormatter);
                }
View Full Code Here

TOP

Related Classes of java.util.logging.SimpleFormatter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.