Package java.util.logging

Examples of java.util.logging.SocketHandler


  implements Testlet
{
  public void test(TestHarness th)
  {
    SocketCapturer capturer;
    SocketHandler handler;
    String captured = null;

    // Check #1.
    try
      {
        capturer = new SocketCapturer(0);
        handler = new SocketHandler("0.0.0.0", capturer.getLocalPort());
        handler.setLevel(Level.FINE);
        handler.publish(new LogRecord(Level.CONFIG, "hello, world"));
        handler.publish(new LogRecord(Level.FINER, "how are you?"));
        handler.close();
        captured = new String(capturer.getCaptured());
        th.check(true);
      }
    catch (Exception ex)
      {
View Full Code Here


public class getFilter
  implements Testlet
{
  public void test(TestHarness th)
  {
    SocketHandler handler;

    // Check #1.
    try
      {
        ServerSocket socket = new ServerSocket(0);
        handler = new SocketHandler("0.0.0.0", socket.getLocalPort());
        socket.close();
        th.check(handler.getFilter() == null);
      }
    catch (Exception ex)
      {
        th.check(false);
        th.debug(ex);
View Full Code Here

public class getFormatter
  implements Testlet
{
  public void test(TestHarness th)
  {
    SocketHandler handler;

    // Check #1.
    try
      {
        ServerSocket socket = new ServerSocket(0);
        handler = new SocketHandler("0.0.0.0", socket.getLocalPort());
        socket.close();
        th.check(handler.getFormatter() instanceof XMLFormatter);
      }
    catch (Exception ex)
      {
        th.check(false);
        th.debug(ex);
View Full Code Here

    // start the server to be ready to accept log messages
    ServerThread thread = new ServerThread();
    thread.start();
    Thread.sleep(2000);

    h = new SocketHandler();
    h.setLevel(Level.INFO);

    SecurityManager oldMan = System.getSecurityManager();
    System.setSecurityManager(new MockSecurityManager());
    try {
View Full Code Here

    // start the server to be ready to accept log messages
    ServerThread thread = new ServerThread();
    thread.start();
    Thread.sleep(2000);

    h = new SocketHandler();
    h.setLevel(Level.INFO);

    LogRecord r = new LogRecord(Level.INFO, "testPublish_NoFilter");
    h.setLevel(Level.INFO);
    h.publish(r);
View Full Code Here

    // start the server to be ready to accept log messages
    ServerThread thread = new ServerThread();
    thread.start();
    Thread.sleep(2000);
    h = new SocketHandler();
    h.setLevel(Level.INFO);
    h.setFilter(new MockFilter());

    System.setErr(new PrintStream(new ByteArrayOutputStream()));
View Full Code Here

    // start the server to be ready to accept log messages
    ServerThread thread = new ServerThread();
    thread.start();
    Thread.sleep(2000);
    h = new SocketHandler();
    h.setLevel(Level.INFO);
    try {
      h.publish(null);
    } finally {
      h.close();
View Full Code Here

    // start the server to be ready to accept log messages
    ServerThread thread = new ServerThread();
    thread.start();
    Thread.sleep(2000);
    h = new SocketHandler();
    h.setLevel(Level.INFO);
    LogRecord r = new LogRecord(Level.INFO, "");
    h.publish(r);
    h.close();
    assertEquals("MockFormatter_Head" + "MockFormatter_Tail", thread
View Full Code Here

    // start the server to be ready to accept log messages
    ServerThread thread = new ServerThread();
    thread.start();
    Thread.sleep(2000);
    h = new SocketHandler();
    h.setLevel(Level.INFO);
    LogRecord r = new LogRecord(Level.INFO, null);
    h.publish(r);
    h.close();
    assertEquals("MockFormatter_Head" + "MockFormatter_Tail", thread
View Full Code Here

    // start the server to be ready to accept log messages
    ServerThread thread = new ServerThread();
    thread.start();
    Thread.sleep(2000);
    h = new SocketHandler();
    h.setLevel(Level.FINE);

    assertSame(h.getLevel(), Level.FINE);
    LogRecord r = new LogRecord(Level.INFO, "testPublish_NoFormatter");
    assertTrue(h.isLoggable(r));
View Full Code Here

TOP

Related Classes of java.util.logging.SocketHandler

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.