当前位置: 首页>>代码示例>>Java>>正文


Java Logger.setFactory方法代码示例

本文整理汇总了Java中com.intellij.openapi.diagnostic.Logger.setFactory方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.setFactory方法的具体用法?Java Logger.setFactory怎么用?Java Logger.setFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.diagnostic.Logger的用法示例。


在下文中一共展示了Logger.setFactory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initLoggers

import com.intellij.openapi.diagnostic.Logger; //导入方法依赖的package包/类
public static void initLoggers() {
  if (!SystemProperties.getBooleanProperty(GlobalOptions.USE_DEFAULT_FILE_LOGGING_OPTION, true)) {
    return;
  }

  try {
    final String logDir = System.getProperty(GlobalOptions.LOG_DIR_OPTION, null);
    final File configFile = logDir != null? new File(logDir, LOG_CONFIG_FILE_NAME) : new File(LOG_CONFIG_FILE_NAME);
    ensureLogConfigExists(configFile);
    String text = FileUtil.loadFile(configFile);
    final String logFile = logDir != null? new File(logDir, LOG_FILE_NAME).getAbsolutePath() : LOG_FILE_NAME;
    text = StringUtil.replace(text, LOG_FILE_MACRO, StringUtil.replace(logFile, "\\", "\\\\"));
    PropertyConfigurator.configure(new ByteArrayInputStream(text.getBytes("UTF-8")));
  }
  catch (IOException e) {
    //noinspection UseOfSystemOutOrSystemErr
    System.err.println("Failed to configure logging: ");
    //noinspection UseOfSystemOutOrSystemErr
    e.printStackTrace(System.err);
  }

  Logger.setFactory(MyLoggerFactory.class);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:LogSetup.java

示例2: prepareAndStart

import com.intellij.openapi.diagnostic.Logger; //导入方法依赖的package包/类
static void prepareAndStart(String[] args, AppStarter appStarter) {
  boolean newConfigFolder = false;

  if (!Main.isHeadless()) {
    AppUIUtil.updateFrameClass();
    newConfigFolder = !new File(PathManager.getConfigPath()).exists();
  }

  if (!checkJdkVersion()) {
    System.exit(Main.JDK_CHECK_FAILED);
  }
  // note: uses config folder!
  if (!checkSystemFolders()) {
    System.exit(Main.DIR_CHECK_FAILED);
  }
  if (!lockSystemFolders(args)) {
    System.exit(Main.INSTANCE_CHECK_FAILED);
  }

  if (newConfigFolder) {
    ConfigImportHelper.importConfigsTo(PathManager.getConfigPath());
  }

  Logger.setFactory(LoggerFactory.class);
  Logger log = Logger.getInstance(Main.class);
  startLogging(log);
  loadSystemLibraries(log);
  fixProcessEnvironment(log);

  if (!Main.isHeadless()) {
    AppUIUtil.updateWindowIcon(JOptionPane.getRootFrame());
    AppUIUtil.registerBundledFonts();
  }

  appStarter.start(newConfigFolder);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:StartupUtil.java

示例3: runBuild

import com.intellij.openapi.diagnostic.Logger; //导入方法依赖的package包/类
private void runBuild(final Set<String> modulesSet, final boolean allModules, boolean includeTests) {
  if (!myDryRun) {
    final AntMessageHandler messageHandler = new AntMessageHandler();
    //noinspection AssignmentToStaticFieldFromInstanceMethod
    AntLoggerFactory.ourMessageHandler = new AntMessageHandler();
    AntLoggerFactory.ourFileLoggerFactory = myFileLoggerFactory;
    Logger.setFactory(AntLoggerFactory.class);
    boolean forceBuild = !myBuildIncrementally;

    List<TargetTypeBuildScope> scopes = new ArrayList<TargetTypeBuildScope>();
    for (JavaModuleBuildTargetType type : JavaModuleBuildTargetType.ALL_TYPES) {
      if (includeTests || !type.isTests()) {
        List<String> namesToCompile = new ArrayList<String>(allModules ? getAllModules() : modulesSet);
        if (type.isTests()) {
          namesToCompile.removeAll(myCompiledModuleTests);
          myCompiledModuleTests.addAll(namesToCompile);
        }
        else {
          namesToCompile.removeAll(myCompiledModules);
          myCompiledModules.addAll(namesToCompile);
        }
        if (namesToCompile.isEmpty()) continue;

        TargetTypeBuildScope.Builder builder = TargetTypeBuildScope.newBuilder().setTypeId(type.getTypeId()).setForceBuild(forceBuild);
        if (allModules) {
          scopes.add(builder.setAllTargets(true).build());
        }
        else if (!modulesSet.isEmpty()) {
          scopes.add(builder.addAllTargetId(modulesSet).build());
        }
      }
    }

    info("Starting build; incremental: " + myBuildIncrementally + ", cache directory: " + myDataStorageRoot.getAbsolutePath());
    info("Build scope: " + (allModules ? "all" : modulesSet.size()) + " modules, " + (includeTests ? "including tests" : "production only"));
    long compilationStart = System.currentTimeMillis();
    try {
      myBuildInfoPrinter.printBlockOpenedMessage(this, "Compilation");
      Standalone.runBuild(myModelLoader, myDataStorageRoot, messageHandler, scopes, false);
    }
    catch (Throwable e) {
      error(e);
    }
    finally {
      myBuildInfoPrinter.printBlockClosedMessage(this, "Compilation");
    }
    if (messageHandler.myFailed) {
      error("Compilation failed");
    }
    else if (!myStatisticsReported) {
      myBuildInfoPrinter.printStatisticsMessage(this, "Compilation time, ms", String.valueOf(System.currentTimeMillis() - compilationStart));
      myStatisticsReported = true;
    }
  }
  else {
    info("Building skipped as we're running dry");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:59,代码来源:JpsGantProjectBuilder.java


注:本文中的com.intellij.openapi.diagnostic.Logger.setFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。