本文整理了Java中org.sonar.api.utils.log.Logger.error()
方法的一些代码示例,展示了Logger.error()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.error()
方法的具体详情如下:
包路径:org.sonar.api.utils.log.Logger
类名称:Logger
方法名:error
[英]Logs an ERROR level message.
[中]记录错误级别消息。
代码示例来源:origin: SonarSource/sonarqube
private void logError(String msg, @Nullable Object[] args) {
if (args == null) {
logger.error(msg);
} else {
logger.error(msg, args);
}
}
代码示例来源:origin: SonarSource/sonarqube
private static Consumer<ProjectLifeCycleListener> safelyCallListener(Consumer<ProjectLifeCycleListener> task) {
return listener -> {
try {
task.accept(listener);
} catch (Error | Exception e) {
LOG.error("Call on ProjectLifeCycleListener \"{}\" failed", listener.getClass(), e);
}
};
}
}
代码示例来源:origin: SonarSource/sonarqube
private boolean attemptStartup() {
try {
startup();
return true;
} catch (org.sonar.api.utils.MessageException | org.sonar.process.MessageException e) {
LOG.error("Compute Engine startup failed: " + e.getMessage());
return false;
} catch (Throwable e) {
LOG.error("Compute Engine startup failed", e);
return false;
}
}
代码示例来源:origin: SonarSource/sonarqube
public void clean() {
try {
if (tempDir.exists()) {
Files.walkFileTree(tempDir.toPath(), DeleteRecursivelyFileVisitor.INSTANCE);
}
} catch (IOException e) {
LOG.error("Failed to delete temp folder", e);
}
}
代码示例来源:origin: SonarSource/sonarqube
private void callListeners(Consumer<ExecutionListener> call) {
listeners.forEach(listener -> {
try {
call.accept(listener);
} catch (Throwable t) {
LOG.error(format("Call to listener %s failed.", listener.getClass().getSimpleName()), t);
}
});
}
}
代码示例来源:origin: SonarSource/sonarqube
private static void closeJar(@Nullable JarFile jar, String jarPath) {
if (jar != null) {
try {
jar.close();
} catch (Exception e) {
Loggers.get(ClassLoaderUtils.class).error("Fail to close JAR file: " + jarPath, e);
}
}
}
代码示例来源:origin: SonarSource/sonarqube
private static void executeTask(ProjectAnalysisImpl projectAnalysis, PostProjectAnalysisTask postProjectAnalysisTask) {
try {
postProjectAnalysisTask.finished(projectAnalysis);
} catch (Exception e) {
LOG.error("Execution of task " + postProjectAnalysisTask.getClass() + " failed", e);
}
}
代码示例来源:origin: SonarSource/sonarqube
private Optional<CeTask> tryAndFindTaskToExecute() {
try {
return queue.peek(uuid);
} catch (Exception e) {
LOG.error("Failed to pop the queue of analysis reports", e);
}
return Optional.empty();
}
代码示例来源:origin: SonarSource/sonarqube
private void executeListener(boolean allStepsExecuted) {
try {
listener.finished(allStepsExecuted);
} catch (Throwable e) {
// any Throwable throws by the listener going up the stack might hide an Exception/Error thrown by the step and
// cause it be swallowed. We don't wan't that => we catch Throwable
LOGGER.error("Execution of listener failed", e);
}
}
代码示例来源:origin: SonarSource/sonarqube
@Override
public void failure(Throwable t) {
LOGGER.error("Background initialization failed. Stopping SonarQube", t);
processCommandWrapper.requestStop();
this.running = false;
}
代码示例来源:origin: SonarSource/sonarqube
@Override
public void addToQueue(Runnable r) {
requireNonNull(r);
executorService.addToQueue(() -> {
try {
r.run();
} catch (Exception e) {
LOG.error("Asynchronous task failed", e);
}
});
}
}
代码示例来源:origin: SonarSource/sonarqube
@Override
public void afterBulk(long executionId, BulkRequest request, Throwable e) {
LOGGER.error("Fail to execute bulk index request: " + request, e);
stopProfiler(request);
}
代码示例来源:origin: SonarSource/sonarqube
private void processMeasure(FileLinesContext context, File measureFile, int lineNumber, String line) {
try {
String metricKey = StringUtils.substringBefore(line, ":");
String value = line.substring(metricKey.length() + 1);
saveMeasure(context, metricKey, KeyValueFormat.parseIntInt(value));
} catch (Exception e) {
LOG.error("Error processing line " + lineNumber + " of file " + measureFile.getAbsolutePath(), e);
throw new IllegalStateException("Error processing line " + lineNumber + " of file " + measureFile.getAbsolutePath(), e);
}
}
代码示例来源:origin: SonarSource/sonarqube
public void unload(Collection<Plugin> plugins) {
for (Plugin plugin : plugins) {
ClassLoader classLoader = plugin.getClass().getClassLoader();
if (classLoader instanceof Closeable && classLoader != classloaderFactory.baseClassLoader()) {
try {
((Closeable) classLoader).close();
} catch (Exception e) {
Loggers.get(getClass()).error("Fail to close classloader " + classLoader.toString(), e);
}
}
}
}
代码示例来源:origin: SonarSource/sonarqube
private Optional<FileBlocks> toFileBlocks(String componentKey, Collection<Block> fileBlocks) {
DefaultInputFile component = (DefaultInputFile) componentStore.getByKey(componentKey);
if (component == null) {
LOG.error("Resource not found in component store: {}. Skipping CPD computation for it", componentKey);
return Optional.empty();
}
return Optional.of(new FileBlocks(component, fileBlocks));
}
代码示例来源:origin: SonarSource/sonarqube
@Override
public void close() {
try {
stopComponents();
} catch (Throwable t) {
Loggers.get(TaskContainerImpl.class).error("Cleanup of container failed", t);
}
}
}
代码示例来源:origin: SonarSource/sonarqube
private static DistributedCall<Object> setLogLevelForNode(LoggerLevel level) {
return () -> {
try {
ServerLogging.changeLevelFromHazelcastDistributedQuery(level);
} catch (Exception e) {
LOGGER.error("Setting log level to '" + level.name() + "' in this cluster node failed", e);
throw new IllegalStateException("Setting log level to '" + level.name() + "' in this cluster node failed", e);
}
return null;
};
}
}
代码示例来源:origin: SonarSource/sonarqube
private void insertPermissionForAdministrators(DbSession dbSession, PermissionTemplateDto template) {
Optional<GroupDto> admins = dbClient.groupDao().selectByName(dbSession, template.getOrganizationUuid(), DefaultGroups.ADMINISTRATORS);
if (admins.isPresent()) {
insertGroupPermission(dbSession, template, UserRole.ADMIN, admins.get());
insertGroupPermission(dbSession, template, UserRole.ISSUE_ADMIN, admins.get());
insertGroupPermission(dbSession, template, UserRole.SECURITYHOTSPOT_ADMIN, admins.get());
insertGroupPermission(dbSession, template, OrganizationPermission.APPLICATION_CREATOR.getKey(), admins.get());
insertGroupPermission(dbSession, template, OrganizationPermission.PORTFOLIO_CREATOR.getKey(), admins.get());
} else {
LOG.error("Cannot setup default permission for group: " + DefaultGroups.ADMINISTRATORS);
}
}
代码示例来源:origin: SonarSource/sonarqube
private void attemptShutdown() {
try {
LOG.info("Compute Engine is stopping...");
computeEngine.shutdown();
LOG.info("Compute Engine is stopped");
} catch (Throwable e) {
LOG.error("Compute Engine failed to stop", e);
} finally {
// release thread waiting for CeServer
stopAwait();
}
}
代码示例来源:origin: SonarSource/sonarqube
void terminate() {
if (tomcat.getServer().getState().isAvailable()) {
try {
tomcat.stop();
tomcat.destroy();
} catch (Exception e) {
Loggers.get(EmbeddedTomcat.class).error("Fail to stop web server", e);
}
}
deleteQuietly(tomcatBasedir());
}
内容来源于网络,如有侵权,请联系作者删除!