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());
}
}
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;
}
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()));
}
});
}
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;
}
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);
}
Aggregations