Tabnine Logo
Profiler.startInfo
Code IndexAdd Tabnine to your IDE (free)

How to use
startInfo
method
in
org.sonar.core.util.logs.Profiler

Best Java code snippets using org.sonar.core.util.logs.Profiler.startInfo (Showing top 16 results out of 315)

origin: SonarSource/sonarqube

public void execute() {
 List<ProjectSensorWrapper> sensors = selector.selectSensors();
 LOG.debug("Sensors : {}", sensors.stream()
  .map(Object::toString)
  .collect(Collectors.joining(" -> ")));
 for (ProjectSensorWrapper sensor : sensors) {
  String sensorName = getSensorName(sensor);
  profiler.startInfo("Sensor " + sensorName);
  sensor.analyse();
  profiler.stopInfo();
 }
}
origin: SonarSource/sonarqube

@Override
public void execute(List<RegisteredMigrationStep> steps) {
 Profiler globalProfiler = Profiler.create(LOGGER);
 globalProfiler.startInfo(GLOBAL_START_MESSAGE);
 boolean allStepsExecuted = false;
 try {
  steps.forEach(this::execute);
  allStepsExecuted = true;
 } finally {
  if (allStepsExecuted) {
   globalProfiler.stopInfo(GLOBAL_END_MESSAGE, "success");
  } else {
   globalProfiler.stopError(GLOBAL_END_MESSAGE, "failure");
  }
 }
}
origin: SonarSource/sonarqube

private void execute(Collection<ModuleSensorWrapper> sensors) {
 for (ModuleSensorWrapper sensor : sensors) {
  String sensorName = getSensorName(sensor);
  profiler.startInfo("Sensor " + sensorName);
  sensor.analyse();
  profiler.stopInfo();
 }
}
origin: SonarSource/sonarqube

private static Profiler startLogProfiler(CeTask task) {
 Profiler profiler = Profiler.create(LOG)
  .logTimeLast(true)
  .addContext("project", task.getMainComponent().flatMap(CeTask.Component::getKey).orElse(null))
  .addContext("type", task.getType());
 for (Map.Entry<String, String> characteristic : task.getCharacteristics().entrySet()) {
  profiler.addContext(characteristic.getKey(), characteristic.getValue());
 }
 return profiler
  .addContext("id", task.getUuid())
  .addContext("submitter", submitterOf(task))
  .startInfo("Execute task");
}
origin: SonarSource/sonarqube

@Test
public void startInfo_writes_log_with_context_appended_when_there_is_a_message() {
 addSomeContext(underTest);
 underTest.startInfo("Foo");
 assertThat(tester.logs(LoggerLevel.INFO)).containsOnly("Foo | a_string=bar | an_int=42 | after_start=true");
}
origin: SonarSource/sonarqube

 private void execute(RegisteredMigrationStep step, MigrationStep migrationStep) {
  Profiler stepProfiler = Profiler.create(LOGGER);
  stepProfiler.startInfo(STEP_START_PATTERN, step);
  boolean done = false;
  try {
   migrationStep.execute();
   migrationHistory.done(step);
   done = true;
  } catch (Exception e) {
   throw new MigrationStepExecutionException(step, e);
  } finally {
   if (done) {
    stepProfiler.stopInfo(STEP_STOP_PATTERN, step, "success");
   } else {
    stepProfiler.stopError(STEP_STOP_PATTERN, step, "failure");
   }
  }
 }
}
origin: SonarSource/sonarqube

@Test
public void empty_message() {
 underTest.addContext("foo", "bar");
 underTest.startInfo("");
 assertThat(tester.logs()).containsOnly("foo=bar");
 underTest.addContext("after_start", true);
 underTest.stopInfo("");
 assertThat(tester.logs()).hasSize(2);
 assertThat(tester.logs().get(1))
  .startsWith("time=")
  .endsWith("ms | foo=bar | after_start=true");
}
origin: SonarSource/sonarqube

@Test
@UseDataProvider("logTimeLastValues")
public void different_start_and_stop_messages(boolean logTimeLast) {
 underTest.logTimeLast(logTimeLast);
 tester.setLevel(LoggerLevel.TRACE);
 // start TRACE and stop DEBUG
 underTest.startTrace("Register rules");
 underTest.stopDebug("Rules registered");
 assertThat(tester.logs()).hasSize(2);
 assertThat(tester.logs().get(0)).contains("Register rules");
 assertThat(tester.logs().get(1)).startsWith("Rules registered | time=");
 tester.clear();
 // start DEBUG and stop INFO
 underTest.startDebug("Register rules {}", 10);
 underTest.stopInfo("Rules registered");
 assertThat(tester.logs()).hasSize(2);
 assertThat(tester.logs().get(0)).contains("Register rules 10");
 assertThat(tester.logs().get(1)).startsWith("Rules registered | time=");
 tester.clear();
 // start INFO and stop TRACE
 underTest.startInfo("Register rules");
 underTest.stopTrace("Rules registered");
 assertThat(tester.logs()).hasSize(2);
 assertThat(tester.logs().get(0)).contains("Register rules");
 assertThat(tester.logs().get(1)).startsWith("Rules registered | time=");
}
origin: SonarSource/sonarqube

private void doDatabaseMigration() {
 migrationState.setStatus(Status.RUNNING);
 migrationState.setStartedAt(new Date());
 migrationState.setError(null);
 Profiler profiler = Profiler.create(LOGGER);
 try {
  profiler.startInfo("Starting DB Migration and container restart");
  doUpgradeDb();
  doRestartContainer();
  migrationState.setStatus(Status.SUCCEEDED);
  profiler.stopInfo("DB Migration and container restart: success");
 } catch (MigrationStepExecutionException e) {
  profiler.stopError("DB migration failed");
  LOGGER.error("DB migration ended with an exception", e);
  saveStatus(e);
 } catch (Throwable t) {
  profiler.stopError("Container restart failed");
  LOGGER.error("Container restart failed", t);
  saveStatus(t);
 } finally {
  semaphore.release();
 }
}
origin: SonarSource/sonarqube

underTest.startInfo("Register rules");
Thread.sleep(2);
assertThat(tester.logs()).containsOnly("Register rules");
origin: org.sonarsource.sonarqube/sonar-ce

private static Profiler startActivityProfiler(CeTask task) {
 Profiler profiler = Profiler.create(LOG);
 addContext(profiler, task);
 return profiler.startInfo("Execute task");
}
origin: org.sonarsource.sonarqube/sonar-scanner-engine

public void execute() {
 List<ProjectSensorWrapper> sensors = selector.selectSensors();
 LOG.debug("Sensors : {}", sensors.stream()
  .map(Object::toString)
  .collect(Collectors.joining(" -> ")));
 for (ProjectSensorWrapper sensor : sensors) {
  String sensorName = getSensorName(sensor);
  profiler.startInfo("Sensor " + sensorName);
  sensor.analyse();
  profiler.stopInfo();
 }
}
origin: org.sonarsource.sonarqube/sonar-db-migration

@Override
public void execute(Stream<RegisteredMigrationStep> steps) {
 Profiler globalProfiler = Profiler.create(LOGGER);
 globalProfiler.startInfo(GLOBAL_START_MESSAGE);
 boolean allStepsExecuted = false;
 try {
  steps.forEachOrdered(this::execute);
  allStepsExecuted = true;
 } finally {
  if (allStepsExecuted) {
   globalProfiler.stopInfo(GLOBAL_END_MESSAGE, "success");
  } else {
   globalProfiler.stopError(GLOBAL_END_MESSAGE, "failure");
  }
 }
}
origin: org.sonarsource.sonarqube/sonar-scanner-engine

private void execute(Collection<ModuleSensorWrapper> sensors) {
 for (ModuleSensorWrapper sensor : sensors) {
  String sensorName = getSensorName(sensor);
  profiler.startInfo("Sensor " + sensorName);
  sensor.analyse();
  profiler.stopInfo();
 }
}
origin: org.sonarsource.sonarqube/sonar-db-migration

 private void execute(RegisteredMigrationStep step, MigrationStep migrationStep) {
  Profiler stepProfiler = Profiler.create(LOGGER);
  stepProfiler.startInfo(STEP_START_PATTERN, step);
  boolean done = false;
  try {
   migrationStep.execute();
   migrationHistory.done(step);
   done = true;
  } catch (Exception e) {
   throw new MigrationStepExecutionException(step, e);
  } finally {
   if (done) {
    stepProfiler.stopInfo(STEP_STOP_PATTERN, step, "success");
   } else {
    stepProfiler.stopError(STEP_STOP_PATTERN, step, "failure");
   }
  }
 }
}
origin: org.sonarsource.sonarqube/sonar-server

private void doDatabaseMigration() {
 migrationState.setStatus(Status.RUNNING);
 migrationState.setStartedAt(new Date());
 migrationState.setError(null);
 Profiler profiler = Profiler.create(LOGGER);
 try {
  profiler.startInfo("Starting DB Migration and container restart");
  doUpgradeDb();
  doRestartContainer();
  migrationState.setStatus(Status.SUCCEEDED);
  profiler.stopInfo("DB Migration and container restart: success");
 } catch (MigrationStepExecutionException e) {
  profiler.stopError("DB migration failed");
  LOGGER.error("DB migration ended with an exception", e);
  saveStatus(e);
 } catch (Throwable t) {
  profiler.stopError("Container restart failed");
  LOGGER.error("Container restart failed", t);
  saveStatus(t);
 } finally {
  semaphore.release();
 }
}
org.sonar.core.util.logsProfilerstartInfo

Popular methods of Profiler

  • create
  • stopInfo
  • stopError
  • addContext
    Context information is removed if value is null.
  • createIfTrace
  • logTimeLast
    Defines whether time is added to stop messages before or after context (if any). flag is false by d
  • start
  • startTrace
  • stopTrace
  • hasContext
  • stopDebug
  • createIfDebug
  • stopDebug,
  • createIfDebug,
  • isDebugEnabled,
  • isTraceEnabled,
  • startDebug

Popular in Java

  • Creating JSON documents from java classes using gson
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
  • getContentResolver (Context)
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JFileChooser (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now