Search in sources :

Example 1 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 2 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 3 with Logger

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

the class Tomcat method setSilent.

/**
     * Controls if the loggers will be silenced or not.
     * @param silent    <code>true</code> sets the log level to WARN for the
     *                  loggers that log information on Tomcat start up. This
     *                  prevents the usual startup information being logged.
     *                  <code>false</code> sets the log level to the default
     *                  level of INFO.
     */
public void setSilent(boolean silent) {
    this.silent = silent;
    for (String s : silences) {
        Logger logger = Logger.getLogger(s);
        pinnedLoggers.put(s, logger);
        if (silent) {
            logger.setLevel(Level.WARNING);
        } else {
            logger.setLevel(Level.INFO);
        }
    }
}
Also used : Logger(java.util.logging.Logger)

Example 4 with Logger

use of java.util.logging.Logger in project GCViewer by chewiebug.

the class DataReaderFacade method loadModel.

/**
     * Loads a model from a given <code>gcResource</code> logging all exceptions that occur.
     *
     * @param gcResource where to find data to be parsed
     * @return instance of GCModel containing all information that was parsed
     * @throws DataReaderException if any exception occurred, it is logged and added as the cause
     * to this exception
     */
public GCModel loadModel(GCResource gcResource) throws DataReaderException {
    if (gcResource == null) {
        throw new NullPointerException("gcResource must never be null");
    }
    if (gcResource instanceof GcResourceSeries) {
        return loadModelFromSeries((GcResourceSeries) gcResource);
    }
    if (!(gcResource instanceof GcResourceFile))
        throw new UnsupportedOperationException("Only supported for files!");
    DataReaderException dataReaderException = new DataReaderException();
    GCModel model = null;
    Logger logger = gcResource.getLogger();
    try {
        logger.info("GCViewer version " + BuildInfoReader.getVersion() + " (" + BuildInfoReader.getBuildDate() + ")");
        model = readModel((GcResourceFile) gcResource);
    } catch (RuntimeException | IOException e) {
        dataReaderException.initCause(e);
        logger.warning(LocalisationHelper.getString("fileopen_dialog_read_file_failed") + "\n" + e.toString() + " " + e.getLocalizedMessage());
    }
    if (dataReaderException.getCause() != null) {
        throw dataReaderException;
    }
    return model;
}
Also used : IOException(java.io.IOException) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) Logger(java.util.logging.Logger) GcResourceSeries(com.tagtraum.perf.gcviewer.model.GcResourceSeries) GCModel(com.tagtraum.perf.gcviewer.model.GCModel)

Example 5 with Logger

use of java.util.logging.Logger in project deeplearning4j by deeplearning4j.

the class Util method disableLogging.

public static Level disableLogging() {
    Logger logger = Logger.getLogger("org.apache.uima");
    while (logger.getLevel() == null) {
        logger = logger.getParent();
    }
    Level level = logger.getLevel();
    logger.setLevel(Level.OFF);
    return level;
}
Also used : Level(java.util.logging.Level) Logger(java.util.logging.Logger)

Aggregations

Logger (java.util.logging.Logger)362 LogRecord (java.util.logging.LogRecord)43 Test (org.junit.Test)41 Handler (java.util.logging.Handler)35 File (java.io.File)18 IOException (java.io.IOException)18 ConsoleHandler (java.util.logging.ConsoleHandler)15 SimpleFormatter (java.util.logging.SimpleFormatter)15 Level (java.util.logging.Level)11 LogManager (java.util.logging.LogManager)10 ArrayList (java.util.ArrayList)8 StreamHandler (java.util.logging.StreamHandler)8 ResourceBundle (java.util.ResourceBundle)7 MockResponse (com.google.mockwebserver.MockResponse)6 Properties (java.util.Properties)6 HashMap (java.util.HashMap)5 FileHandler (java.util.logging.FileHandler)5 TestLogHandler (com.google.common.testing.TestLogHandler)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 FileInputStream (java.io.FileInputStream)4