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

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

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

origin: SonarSource/sonarqube

private void doUpgradeDb() {
 Profiler profiler = Profiler.createIfTrace(LOGGER);
 profiler.startTrace("Starting DB Migration");
 migrationEngine.execute();
 profiler.stopTrace("DB Migration ended");
}
origin: SonarSource/sonarqube

private void doRestartContainer() {
 Profiler profiler = Profiler.createIfTrace(LOGGER);
 profiler.startTrace("Restarting container");
 platform.doStart();
 profiler.stopTrace("Container restarted successfully");
}
origin: SonarSource/sonarqube

@Test
public void stopTrace_adds_context_after_time_by_default() {
 tester.setLevel(LoggerLevel.TRACE);
 addSomeContext(underTest);
 underTest.start().stopTrace("Rules registered");
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs(LoggerLevel.TRACE).get(0))
  .startsWith("Rules registered | time=")
  .endsWith("ms | a_string=bar | an_int=42 | after_start=true");
}
origin: SonarSource/sonarqube

@Test
public void stopTrace_clears_context() {
 tester.setLevel(LoggerLevel.TRACE);
 addSomeContext(underTest);
 underTest.logTimeLast(true);
 underTest.start().stopTrace("Foo");
 underTest.start().stopTrace("Bar");
 assertThat(tester.logs()).hasSize(2);
 List<String> logs = tester.logs(LoggerLevel.TRACE);
 assertThat(logs.get(0))
   .startsWith("Foo | a_string=bar | an_int=42 | after_start=true | time=")
   .endsWith("ms");
 assertThat(logs.get(1))
   .startsWith("Bar | time=")
   .endsWith("ms");
}
origin: SonarSource/sonarqube

@Test
public void stopTrace_adds_context_before_time_if_logTimeLast_is_true() {
 tester.setLevel(LoggerLevel.TRACE);
 addSomeContext(underTest);
 underTest.logTimeLast(true);
 underTest.start().stopTrace("Rules registered");
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs(LoggerLevel.TRACE).get(0))
  .startsWith("Rules registered | a_string=bar | an_int=42 | after_start=true | time=")
  .endsWith("ms");
}
origin: SonarSource/sonarqube

p.stopTrace("loaded");
p.stopTrace("Score matrix computed");
scoreMatrixDumper.dumpAsCsv(scoreMatrix);
p.stopTrace("Matches elected");
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

Thread.sleep(2);
assertThat(tester.logs()).containsOnly("Register rules 1");
long timing = underTest.stopTrace();
assertThat(timing).isGreaterThan(0);
assertThat(tester.logs()).hasSize(2);
Thread.sleep(2);
assertThat(tester.logs()).containsOnly("Register rules");
timing = underTest.stopTrace();
assertThat(timing).isGreaterThan(0);
assertThat(tester.logs()).hasSize(2);
Thread.sleep(2);
assertThat(tester.logs()).containsOnly("Register rules");
timing = underTest.stopTrace();
assertThat(timing).isGreaterThan(0);
assertThat(tester.logs()).hasSize(2);
origin: SonarSource/sonarqube

private void visitNode(Component component, VisitorWrapper visitor) {
 Profiler profiler = Profiler.create(Loggers.get(visitor.getWrappedVisitor().getClass()))
  .startTrace("Visiting component {}", component.getDbKey());
 visitor.visitAny(component);
 switch (component.getType()) {
  case PROJECT:
   visitor.visitProject(component);
   break;
  case DIRECTORY:
   visitor.visitDirectory(component);
   break;
  case FILE:
   visitor.visitFile(component);
   break;
  case VIEW:
   visitor.visitView(component);
   break;
  case SUBVIEW:
   visitor.visitSubView(component);
   break;
  case PROJECT_VIEW:
   visitor.visitProjectView(component);
   break;
  default:
   throw new IllegalStateException(String.format("Unknown type %s", component.getType().name()));
 }
 long duration = profiler.stopTrace();
 incrementDuration(visitor, duration);
}
origin: SonarSource/sonarqube

@Test
@UseDataProvider("logTimeLastValues")
public void log_on_at_stop(boolean logTimeLast) {
 underTest.logTimeLast(logTimeLast);
 tester.setLevel(LoggerLevel.TRACE);
 // trace
 underTest.start();
 underTest.stopTrace("Rules registered");
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs().get(0)).startsWith("Rules registered | time=");
 tester.clear();
 // debug
 underTest.start();
 underTest.stopDebug("Rules registered {} on {}", 6, 10);
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs().get(0)).startsWith("Rules registered 6 on 10 | time=");
 tester.clear();
 // info
 underTest.start();
 underTest.stopInfo("Rules registered");
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs().get(0)).startsWith("Rules registered | time=");
}
origin: org.sonarsource.sonarqube/sonar-server

private void doRestartContainer() {
 Profiler profiler = Profiler.createIfTrace(LOGGER);
 profiler.startTrace("Restarting container");
 platform.doStart();
 profiler.stopTrace("Container restarted successfully");
}
origin: org.sonarsource.sonarqube/sonar-server

private void doUpgradeDb() {
 Profiler profiler = Profiler.createIfTrace(LOGGER);
 profiler.startTrace("Starting DB Migration");
 migrationEngine.execute();
 profiler.stopTrace("DB Migration ended");
}
origin: org.sonarsource.sonarqube/sonar-server

p.stopTrace("loaded");
p.stopTrace("Score matrix computed");
scoreMatrixDumper.dumpAsCsv(scoreMatrix);
p.stopTrace("Matches elected");
origin: org.sonarsource.sonarqube/sonar-server

  throw new IllegalStateException(String.format("Unknown type %s", component.getType().name()));
long duration = profiler.stopTrace();
incrementDuration(visitor, duration);
org.sonar.core.util.logsProfilerstopTrace

Javadoc

Works only if a message have been set in startXXX() methods.

Popular methods of Profiler

  • create
  • stopInfo
  • startInfo
  • 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
  • hasContext
  • stopDebug
  • createIfDebug
  • stopDebug,
  • createIfDebug,
  • isDebugEnabled,
  • isTraceEnabled,
  • startDebug

Popular in Java

  • Reactive rest calls using spring rest template
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • runOnUiThread (Activity)
  • setRequestProperty (URLConnection)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • ImageIO (javax.imageio)
  • Best IntelliJ 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