Search in sources :

Example 56 with Logger

use of java.util.logging.Logger in project j2objc by google.

the class LoggerTest method testAddHandler_Null.

/*
	 * Test addHandler(Handler) with a null handler.
	 */
public void testAddHandler_Null() {
    Logger log = Logger.getLogger("testAddHandler_Null");
    try {
        log.addHandler(null);
        fail("Should throw NullPointerException!");
    } catch (NullPointerException e) {
    }
    assertEquals(log.getHandlers().length, 0);
}
Also used : Logger(java.util.logging.Logger)

Example 57 with Logger

use of java.util.logging.Logger in project j2objc by google.

the class LoggerTest method testGetLoggerWithRes_ExistingLoggerWithNoRes.

/*
	 * Test getLogger(String, String) with valid resource bundle, to get an
	 * existing logger with no associated resource bundle.
	 */
public void testGetLoggerWithRes_ExistingLoggerWithNoRes() {
    assertNull(LogManager.getLogManager().getLogger("testGetLoggerWithRes_ExistingLoggerWithNoRes_ANewLogger"));
    // create a new logger
    Logger log1 = Logger.getLogger("testGetLoggerWithRes_ExistingLoggerWithNoRes_ANewLogger");
    // get an existing logger
    Logger log2 = Logger.getLogger("testGetLoggerWithRes_ExistingLoggerWithNoRes_ANewLogger", VALID_RESOURCE_BUNDLE);
    assertSame(log1, log2);
    assertEquals(VALID_VALUE, log1.getResourceBundle().getString(VALID_KEY));
    assertEquals(log1.getResourceBundleName(), VALID_RESOURCE_BUNDLE);
}
Also used : Logger(java.util.logging.Logger)

Example 58 with Logger

use of java.util.logging.Logger in project groovy by apache.

the class NodePrinterTest method testLogging.

public void testLogging() {
    Logger log = Logger.getLogger(getClass().getName());
    log.info("Logging using JDK 1.4 logging");
}
Also used : Logger(java.util.logging.Logger)

Example 59 with Logger

use of java.util.logging.Logger in project camel by apache.

the class BonitaAPIUtil method getInstance.

public static BonitaAPIUtil getInstance(BonitaAPIConfig bonitaAPIConfig) {
    if (instance == null) {
        instance = new BonitaAPIUtil();
        ClientConfig clientConfig = new ClientConfig();
        clientConfig.register(MultiPartFeature.class);
        clientConfig.register(JacksonJsonProvider.class);
        Logger logger = Logger.getLogger("org.bonitasoft.camel.bonita.api.util.BonitaAPIUtil");
        Feature feature = new LoggingFeature(logger, Level.INFO, null, null);
        clientConfig.register(feature);
        ClientBuilder clientBuilder = ClientBuilder.newBuilder().withConfig(clientConfig);
        Client client = clientBuilder.build();
        client.register(new JsonClientFilter());
        client.register(new BonitaAuthFilter(bonitaAPIConfig));
        instance.setWebTarget(client.target(bonitaAPIConfig.getBaseBonitaURI()));
    }
    return instance;
}
Also used : LoggingFeature(org.glassfish.jersey.logging.LoggingFeature) JsonClientFilter(org.apache.camel.component.bonita.api.filter.JsonClientFilter) ClientConfig(org.glassfish.jersey.client.ClientConfig) Logger(java.util.logging.Logger) Client(javax.ws.rs.client.Client) BonitaAuthFilter(org.apache.camel.component.bonita.api.filter.BonitaAuthFilter) Feature(javax.ws.rs.core.Feature) MultiPartFeature(org.glassfish.jersey.media.multipart.MultiPartFeature) LoggingFeature(org.glassfish.jersey.logging.LoggingFeature) ClientBuilder(javax.ws.rs.client.ClientBuilder)

Example 60 with Logger

use of java.util.logging.Logger in project byte-buddy by raphw.

the class ByteBuddyLogHandler method initialize.

/**
     * Initializes the Byte Buddy log handler.
     *
     * @param project The current project.
     * @return The registered log handler.
     */
public static ByteBuddyLogHandler initialize(Project project) {
    Logger logger = Logger.getLogger("net.bytebuddy");
    ByteBuddyLogHandler handler = new ByteBuddyLogHandler(project, logger, logger.getUseParentHandlers());
    try {
        logger.setUseParentHandlers(false);
        logger.addHandler(handler);
    } catch (SecurityException exception) {
        project.getLogger().warn("Cannot configure Byte Buddy logging", exception);
    }
    return handler;
}
Also used : Logger(java.util.logging.Logger)

Aggregations

Logger (java.util.logging.Logger)499 Test (org.junit.Test)70 LogRecord (java.util.logging.LogRecord)60 ActionReport (org.glassfish.api.ActionReport)56 Handler (java.util.logging.Handler)52 IOException (java.io.IOException)37 File (java.io.File)36 Level (java.util.logging.Level)25 ArrayList (java.util.ArrayList)22 ConsoleHandler (java.util.logging.ConsoleHandler)19 Properties (java.util.Properties)15 SimpleFormatter (java.util.logging.SimpleFormatter)15 Config (com.sun.enterprise.config.serverbeans.Config)14 HashMap (java.util.HashMap)14 Map (java.util.Map)12 ByteArrayOutputStream (java.io.ByteArrayOutputStream)11 ResourceBundle (java.util.ResourceBundle)11 LogManager (java.util.logging.LogManager)11 ExtendedDeploymentContext (org.glassfish.internal.deployment.ExtendedDeploymentContext)11 BlockingQueueHandler (fish.payara.nucleus.notification.BlockingQueueHandler)10