Search in sources :

Example 81 with Logger

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

the class JerseyTest method registerLogHandler.

/**
     * Register {@link Handler log handler} to the list of root loggers.
     */
private void registerLogHandler() {
    final String recordLogLevel = getProperty(TestProperties.RECORD_LOG_LEVEL);
    final int recordLogLevelInt = Integer.valueOf(recordLogLevel);
    final Level level = Level.parse(recordLogLevel);
    logLevelMap.clear();
    for (final Logger root : getRootLoggers()) {
        logLevelMap.put(root, root.getLevel());
        if (root.getLevel().intValue() > recordLogLevelInt) {
            root.setLevel(level);
        }
        root.addHandler(getLogHandler());
    }
}
Also used : Level(java.util.logging.Level) Logger(java.util.logging.Logger)

Example 82 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)

Example 83 with Logger

use of java.util.logging.Logger in project che by eclipse.

the class LanguageServerFileTypeRegister method start.

@Override
public void start(final Callback<WsAgentComponent, Exception> callback) {
    Promise<List<LanguageDescriptionDTO>> registeredLanguages = serverLanguageRegistry.getSupportedLanguages();
    registeredLanguages.then(new Operation<List<LanguageDescriptionDTO>>() {

        @Override
        public void apply(List<LanguageDescriptionDTO> langs) throws OperationException {
            if (!langs.isEmpty()) {
                JsArrayString contentTypes = JsArrayString.createArray().cast();
                for (LanguageDescriptionDTO lang : langs) {
                    String primaryExtension = lang.getFileExtensions().get(0);
                    for (String ext : lang.getFileExtensions()) {
                        final FileType fileType = new FileType(resources.file(), ext);
                        fileTypeRegistry.registerFileType(fileType);
                        editorRegistry.registerDefaultEditor(fileType, editorProvider);
                        ext2langId.put(ext, lang.getLanguageId());
                    }
                    List<String> mimeTypes = lang.getMimeTypes();
                    if (mimeTypes.isEmpty()) {
                        mimeTypes = newArrayList("text/x-" + lang.getLanguageId());
                    }
                    for (String contentTypeId : mimeTypes) {
                        contentTypes.push(contentTypeId);
                        OrionContentTypeOverlay contentType = OrionContentTypeOverlay.create();
                        contentType.setId(contentTypeId);
                        contentType.setName(lang.getLanguageId());
                        contentType.setExtension(primaryExtension);
                        contentType.setExtends("text/plain");
                        // highlighting
                        OrionHighlightingConfigurationOverlay config = OrionHighlightingConfigurationOverlay.create();
                        config.setId(lang.getLanguageId() + ".highlighting");
                        config.setContentTypes(contentTypeId);
                        config.setPatterns(lang.getHighlightingConfiguration());
                        Logger logger = Logger.getLogger(LanguageServerFileTypeRegister.class.getName());
                        contentTypeRegistrant.registerFileType(contentType, config);
                    }
                }
                orionHoverRegistrant.registerHover(contentTypes, hoverProvider);
                orionOccurrencesRegistrant.registerOccurrencesHandler(contentTypes, occurrencesProvider);
            }
            callback.onSuccess(LanguageServerFileTypeRegister.this);
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError arg) throws OperationException {
            callback.onFailure(new Exception(arg.getMessage(), arg.getCause()));
        }
    });
}
Also used : OrionHighlightingConfigurationOverlay(org.eclipse.che.ide.editor.orion.client.jso.OrionHighlightingConfigurationOverlay) LanguageDescriptionDTO(org.eclipse.che.api.languageserver.shared.lsapi.LanguageDescriptionDTO) OrionContentTypeOverlay(org.eclipse.che.ide.editor.orion.client.jso.OrionContentTypeOverlay) Operation(org.eclipse.che.api.promises.client.Operation) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) Logger(java.util.logging.Logger) OperationException(org.eclipse.che.api.promises.client.OperationException) PromiseError(org.eclipse.che.api.promises.client.PromiseError) FileType(org.eclipse.che.ide.api.filetypes.FileType) List(java.util.List) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 84 with Logger

use of java.util.logging.Logger in project AuthMeReloaded by AuthMe.

the class TestHelper method setupLogger.

/**
     * Assign the necessary fields on ConsoleLogger with mocks.
     *
     * @return The logger mock used
     */
public static Logger setupLogger() {
    Logger logger = Mockito.mock(Logger.class);
    ConsoleLogger.setLogger(logger);
    return logger;
}
Also used : Logger(java.util.logging.Logger)

Example 85 with Logger

use of java.util.logging.Logger in project AuthMeReloaded by AuthMe.

the class OnStartupTasksTest method shouldNotDisplayLegacyHintForWrongCause.

@Test
public void shouldNotDisplayLegacyHintForWrongCause() {
    // given
    Logger logger = TestHelper.setupLogger();
    // when
    OnStartupTasks.verifyIfLegacyJarIsNeeded();
    // then
    verifyZeroInteractions(logger);
}
Also used : Logger(java.util.logging.Logger) Test(org.junit.Test)

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