Package java.util.logging

Examples of java.util.logging.StreamHandler


    @Test
    public void changeVariables_isSourceConnectorEnabledCalled() {
        final List<Level> levels = new ArrayList<Level>();
        Logger.getLogger(DragAndDropService.class.getName()).addHandler(
                new StreamHandler() {
                    @Override
                    public synchronized void publish(LogRecord record) {
                        levels.add(record.getLevel());
                    }
                });
View Full Code Here


    @Test
    public void changeVariables_isTargetConnectorEnabledCalled() {
        final List<Level> levels = new ArrayList<Level>();
        Logger.getLogger(DragAndDropService.class.getName()).addHandler(
                new StreamHandler() {
                    @Override
                    public void publish(LogRecord record) {
                        levels.add(record.getLevel());
                    }
                });
View Full Code Here

   *          whether or not this is in debug mode
   */
  public synchronized void debug(boolean debug) {
    this.debug = debug;
    if (debug && debugHandler == null) {
      debugHandler = new StreamHandler(System.out, new SimpleFormatter());
      debugHandler.setLevel(Level.ALL);
    }
  }
View Full Code Here

    }

    @BeforeClass
    public static void redirectLoggerOutput() throws IOException {
        logOutput = new ByteArrayOutputStream();
        logHandler = new StreamHandler(logOutput, new SimpleFormatter());
        logHandler.setLevel(Level.ALL);
        LOGGER.addHandler(logHandler);
    }
View Full Code Here

  implements Testlet
{
  public void test(TestHarness h)
  {
    XMLFormatter formatter = new XMLFormatter();
    StreamHandler handler = new StreamHandler();

    // Check #1.
    h.check(formatter.getTail(handler),
            "</log>" + System.getProperty("line.separator"));
View Full Code Here

  implements Testlet
{
  public void test(TestHarness h)
  {
    Formatter formatter;
    StreamHandler handler;

    formatter = new XMLFormatter();
    handler = new StreamHandler();

    // Check point "no encoding set".
    h.checkPoint("no encoding set");
    h.check(formatter.getHead(handler),
            getExpectedHead(System.getProperty("file.encoding")));


    // Check point "UTF-8".
    h.checkPoint("UTF-8");
    try
      {
        handler.setEncoding("UTF-8");
      }
    catch (Exception ex)
      {
        h.check(false);
        h.debug(ex);
View Full Code Here

    public static org.syrup.Data manageError(Logger logger, Throwable error,
        String msg)
    {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();

        Handler logHandler = new StreamHandler(buffer, new XMLFormatter());
        logHandler.setLevel(Level.ALL);
        logger.addHandler(logHandler);

        try
        {
            logger.log(Level.SEVERE, msg, error);
            logHandler.flush();
            logHandler.close();
            return new DataImpl(buffer.toByteArray());
        }
        finally
        {
            // Make sure it is always removed so that it won't leak.
View Full Code Here

    @Before
    public void setUp() throws FileNotFoundException {
        System.setProperty("org.jruby.embed.localcontext.scope", "threadsafe");

        outStream = new FileOutputStream(basedir + "/build/test-results/run-junit-embed.log", true);
        Handler handler = new StreamHandler(outStream, new SimpleFormatter());
        logger0.addHandler(handler);
        logger0.setUseParentHandlers(false);
        logger0.setLevel(Level.INFO);
        logger1.setUseParentHandlers(false);
        logger1.addHandler(new ConsoleHandler());
View Full Code Here

            basedir + "/test",
            basedir
        };
        ruby19loadPaths = Arrays.asList(paths);
        outStream = new FileOutputStream(basedir + "/build/test-results/run-junit-embed.log", true);
        Handler handler = new StreamHandler(outStream, new SimpleFormatter());
        logger0.addHandler(handler);
        logger0.setUseParentHandlers(false);
        logger0.setLevel(Level.INFO);
        logger1.setUseParentHandlers(false);
        logger1.addHandler(new ConsoleHandler());
View Full Code Here

    @Before
    public void setUp() throws FileNotFoundException {
        System.setProperty("org.jruby.embed.localcontext.scope", "threadsafe");

        outStream = new FileOutputStream(basedir + "/build/test-results/run-junit-embed.log", true);
        Handler handler = new StreamHandler(outStream, new SimpleFormatter());
        logger0.addHandler(handler);
        logger0.setUseParentHandlers(false);
        logger0.setLevel(Level.INFO);
        logger1.setUseParentHandlers(false);
        logger1.addHandler(new ConsoleHandler());
View Full Code Here

TOP

Related Classes of java.util.logging.StreamHandler

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.