jetbrains.buildServer.log.Loggers Java Examples

The following examples show how to use jetbrains.buildServer.log.Loggers. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KubePodNameGeneratorImpl.java    From teamcity-kubernetes-plugin with Apache License 2.0 6 votes vote down vote up
private void storeIdxes() {
  // wait for generation operations to finish:
  try {
    if (!myLock.writeLock().tryLock(100, TimeUnit.MILLISECONDS)) {
      Loggers.AGENT.warn("Waited more than 100ms to store Kube indexes");
    }
    for (Map.Entry<String, AtomicBoolean> entry : myIdxTouchedMaps.entrySet()) {
      if (entry.getValue().compareAndSet(true, false)) {
        final AtomicInteger counter = myCounters.get(entry.getKey());
        try {
          final File idxFile = new File(myIdxStorage, entry.getKey() + ".idx");
          FileUtil.writeViaTmpFile(idxFile, new ByteArrayInputStream(String.valueOf(counter.get()).getBytes()), FileUtil.IOAction.DO_NOTHING);
        } catch (IOException ignored) {
        }
      }
    }
  } catch (InterruptedException e) {
    e.printStackTrace();
  } finally {
    myLock.writeLock().unlock();
  }
}
 
Example #2
Source File: S3CleanupExtension.java    From teamcity-s3-artifact-storage-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void cleanupBuildsData(@NotNull BuildCleanupContext cleanupContext) {
  for (SFinishedBuild build : cleanupContext.getBuilds()) {
    try {
      final ArtifactListData artifactsInfo = myHelper.getArtifactList(build);
      if (artifactsInfo == null) {
        continue;
      }
      final String pathPrefix = S3Util.getPathPrefix(artifactsInfo);
      if (pathPrefix == null) {
        continue;
      }

      List<String> pathsToDelete = ArtifactPathsEvaluator.getPathsToDelete((BuildCleanupContextEx)cleanupContext, build, artifactsInfo);
      if (pathsToDelete.isEmpty()) {
        continue;
      }

      doClean(cleanupContext.getErrorReporter(), build, pathPrefix, pathsToDelete);
    } catch (Throwable e) {
      Loggers.CLEANUP.debug(e);
      cleanupContext.getErrorReporter().buildCleanupError(build.getBuildId(), "Failed to remove S3 artifacts: " + e.getMessage());
    }
  }
}
 
Example #3
Source File: Server.java    From TeamCity-Phabricator-Plugin with MIT License 5 votes vote down vote up
public Server(
        @NotNull final EventDispatcher<BuildServerListener> buildServerListener,
        @NotNull final PhabLogger logger
){
    buildServerListener.addListener(this);
    this.logger = logger;
    Loggers.SERVER.info("Phab Server Initialized");
}
 
Example #4
Source File: BuildTracker.java    From TeamCity-Phabricator-Plugin with MIT License 5 votes vote down vote up
public void run(){
    while (!build.isFinished()){
        if(!appConfig.isEnabled()){
            try{
                Map<String, String> params = new HashMap<>();
                params.putAll(this.build.getBuildOwnParameters());
                if(!this.build.getBuildFeaturesOfType("phabricator").isEmpty())
                    params.putAll(this.build.getBuildFeaturesOfType("phabricator").iterator().next().getParameters());
                for(String param : params.keySet())
                    if(param != null) Loggers.AGENT.info(String.format("Found %s", param));
                this.appConfig.setParams(params);
                this.appConfig.parse();
            } catch (Exception e) { Loggers.SERVER.error("BuildTracker Param Parse", e); }
        } else {
            build
                    .getBuildStatistics(BuildStatisticsOptions.ALL_TESTS_NO_DETAILS)
                    .getAllTests()
                    .forEach(
                            testRun -> {
                                if(!this.tests.containsKey(testRun.getTest().getName().getAsString())) {
                                    this.tests.put(testRun.getTest().getName().getAsString(),
                                            testRun.getTest());
                                    sendTestReport(testRun.getTest().getName().getAsString(),
                                            testRun);
                                }

                            }
                    );
        }
    }
    Loggers.SERVER.info(this.build.getBuildNumber() + " finished");
}
 
Example #5
Source File: DeployerSettingsConverter.java    From teamcity-deployer-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void serverStartup() {
  myServer.removeListener(this);
  Loggers.SERVER.debug("Server started up, will not convert passwords in configurations from now on.");
}
 
Example #6
Source File: BuildTracker.java    From TeamCity-Phabricator-Plugin with MIT License 4 votes vote down vote up
public BuildTracker(SRunningBuild build){
    this.build = build;
    this.appConfig = new AppConfig();
    this.tests = new HashMap<>();
    Loggers.SERVER.info("Tracking build" + build.getBuildNumber());
}
 
Example #7
Source File: PhabLogger.java    From TeamCity-Phabricator-Plugin with MIT License 4 votes vote down vote up
public void info(String message){
    Loggers.SERVER.info(String.format("Phabricator Plugin: %s", message));
}
 
Example #8
Source File: PhabLogger.java    From TeamCity-Phabricator-Plugin with MIT License 4 votes vote down vote up
public void warn(String message, Exception e){
    Loggers.SERVER.warn(message, e);
}
 
Example #9
Source File: PhabLogger.java    From TeamCity-Phabricator-Plugin with MIT License 4 votes vote down vote up
public void serverInfo(String message){
    Loggers.SERVER.info(message);
}