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


Java Logger类代码示例

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


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

示例1: fillMaps

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
private static void fillMaps() throws IOException {
  Logger log = Logger.getInstance(UnsupportedFeaturesUtil.class.getName());
  FileReader reader = new FileReader(PythonHelpersLocator.getHelperPath("/tools/versions.xml"));
  try {
    XMLReader xr = XMLReaderFactory.createXMLReader();
    VersionsParser parser = new VersionsParser();
    xr.setContentHandler(parser);
    xr.parse(new InputSource(reader));
  }
  catch (SAXException e) {
    log.error("Improperly formed \"versions.xml\". " + e.getMessage());
  }
  finally {
    reader.close();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:UnsupportedFeaturesUtil.java

示例2: getBinary

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
@NotNull
public static String getBinary(String envVar, String propVar, @NotNull String defaultBinary) {
    Logger log = Logger.getInstance("ReasonML");
    log.info("Identifying '" + defaultBinary + "' binary");

    String binary = System.getProperty(propVar);
    if (binary != null) {
        log.info("Found '" + binary + "' in the property '" + propVar + "'");
        return binary;
    }

    log.info("Property '" + envVar + "' not found, testing environment variable '" + propVar + "'");
    binary = System.getenv(envVar);
    if (binary != null) {
        log.info("Found '" + binary + "' in the environment variable '" + envVar + "'");
        return binary;
    }

    log.warn("No '" + defaultBinary + "' found in environment or properties, use default one");
    return defaultBinary;
}
 
开发者ID:reasonml-editor,项目名称:reasonml-idea-plugin,代码行数:22,代码来源:Platform.java

示例3: log

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public static void log(Logger logger, String title, String details, NotificationType level) {
    switch (level) {
        case ERROR:
            logger.error(title, details);
            break;
        case WARNING:
            logger.warn(title + "\n" + details);
            break;
        default:
            logger.info(title + "\n" + details);
    }
    if (StringUtils.isBlank(details)) {
        details = title;
    }
    Notifications.Bus.notify(EVENT_LOG_NOTIFIER.createNotification(title, details, level, null));
}
 
开发者ID:JFrogDev,项目名称:jfrog-idea-plugin,代码行数:17,代码来源:Utils.java

示例4: repoInfo

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public static RepoInfo repoInfo(String fileName) {
    String fileRel = "";
    String remoteURL = "";
    String branch = "";
    try{
        // Determine repository root directory.
        String fileDir = fileName.substring(0, fileName.lastIndexOf("/"));
        String repoRoot = gitRootDir(fileDir);

        // Determine file path, relative to repository root.
        fileRel = fileName.substring(repoRoot.length()+1);
        remoteURL = gitDefaultRemoteURL(repoRoot);
        branch = gitBranch(repoRoot);
    } catch (Exception err) {
        Logger.getInstance(Util.class).info(err);
        err.printStackTrace();
    }
    return new RepoInfo(fileRel, remoteURL, branch);
}
 
开发者ID:sourcegraph,项目名称:sourcegraph-jetbrains,代码行数:20,代码来源:Util.java

示例5: exec

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public static String exec(String cmd, String dir) throws IOException {
    Logger.getInstance(Util.class).debug("exec cmd='" + cmd + "' dir="+dir);

    // Create the process.
    Process p = Runtime.getRuntime().exec(cmd, null, new File(dir));
    BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream()));
    BufferedReader stderr = new BufferedReader(new InputStreamReader(p.getErrorStream()));

    // Log any stderr ouput.
    Logger logger = Logger.getInstance(Util.class);
    String s;
    while ((s = stderr.readLine()) != null) {
        logger.debug(s);
    }

    String out = new String();
    for (String l; (l = stdout.readLine()) != null; out += l + "\n");
    return out;
}
 
开发者ID:sourcegraph,项目名称:sourcegraph-jetbrains,代码行数:20,代码来源:Util.java

示例6: applyFix

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public void applyFix(@NotNull Project project,
                     @NotNull ProblemDescriptor descriptor) {
  final PsiElement problemElement = descriptor.getPsiElement();
  if (problemElement == null || !problemElement.isValid()) {
    return;
  }
  if (isQuickFixOnReadOnlyFile(problemElement)) {
    return;
  }
  try {
    doFix(project, descriptor);
  } catch (IncorrectOperationException e) {
    final Class<? extends LuaFix> aClass = getClass();
    final String className = aClass.getName();
    final Logger logger = Logger.getInstance(className);
    logger.error(e);
  }
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:19,代码来源:LuaFix.java

示例7: invoke

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project,
                   @NotNull PsiFile file,
                   Editor editor, @NotNull PsiElement startElement,
                   @NotNull PsiElement endElement) {
  if (!FileModificationService.getInstance().prepareFileForWrite(file)) {
    return;
  }

  try {
    invokeImpl(project, file);
  }
  catch (IncorrectOperationException e) {
    Logger.getInstance(getClass().getName()).error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:XPathQuickFixFactory.java

示例8: applyFix

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public final void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
  final PsiElement problemElement = descriptor.getPsiElement();
  if (problemElement == null || !problemElement.isValid()) {
    return;
  }
  if (isQuickFixOnReadOnlyFile(problemElement)) {
    return;
  }
  try {
    doFix(project, problemElement);
  }
  catch (IncorrectOperationException e) {
    final Class<? extends TitleCapitalizationFix> aClass = getClass();
    final String className = aClass.getName();
    final Logger logger = Logger.getInstance(className);
    logger.error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:TitleCapitalizationInspection.java

示例9: load

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
@Override
public void load(@NotNull Consumer<String> consumer) {
  try {
    BufferedReader br = new BufferedReader(new InputStreamReader(stream, CharsetToolkit.UTF8_CHARSET));
    try {
      String line;
      while ((line = br.readLine()) != null) {
        consumer.consume(line);
      }
    }
    finally {
      br.close();
    }
  }
  catch (Exception e) {
    Logger.getInstance(StreamLoader.class).error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:StreamLoader.java

示例10: createComponent

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public final JComponent createComponent() {
  if (myOptionsComponent == null){
    myOptionsComponent = createOptionsPanel();
    final JComponent component = createTopRightComponent();
    if (component == null) {
      myTopRightPanel.setVisible(false);
    }
    else {
      myTopRightPanel.add(component, BorderLayout.CENTER);
    }
  }
  if (myOptionsComponent != null) {
    myOptionsPanel.add(myOptionsComponent, BorderLayout.CENTER);
  }
  else {
    Logger.getInstance(getClass().getName()).error("Options component is null for "+getClass());
  }
  updateName();
  return myWholePanel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:NamedConfigurable.java

示例11: setInstalled

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public void setInstalled(@NotNull IDevice device, @NotNull File apk, @NotNull String pkgName) throws IOException {
  String serial = device.getSerialNumber();
  Map<String, InstallState> cache = myCache.get(serial);
  if (cache == null) {
    cache = Maps.newHashMap();
    myCache.put(serial, cache);
  }

  String lastUpdateTime = getLastUpdateTime(device, pkgName);
  if (lastUpdateTime == null) {
    // set installed should be called only after the package has been installed
    // If this error happens, look at the output of "dumpsys package <name>", and see why the parser did not identify the install state.
    String msg = String.format("Unexpected error: package manager reports that package %1$s has not been installed: %2$s", pkgName,
                               StringUtil.notNullize(myDiagnosticOutput));

    // We used to log an error, but see https://code.google.com/p/android/issues/detail?id=79778 for a case where this doesn't work
    // on custom Android systems. So we just log a warning: the impact is that these users won't have any benefits of caching - the apk
    // will always be uploaded
    Logger.getInstance(InstalledApks.class).warn(msg);
    return;
  }
  cache.put(pkgName, new InstallState(hash(apk), lastUpdateTime));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:InstalledApks.java

示例12: getRequiredFeatures

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
@NotNull
public List<UsesFeature> getRequiredFeatures() {
  final List<Manifest> manifests = getManifests();
  if (manifests.isEmpty()) {
    Logger.getInstance(ManifestInfo.class).warn("List of manifests is empty, possibly needs a gradle sync.");
  }

  return ApplicationManager.getApplication().runReadAction(new Computable<List<UsesFeature>>() {
    @Override
    public List<UsesFeature> compute() {
      List<UsesFeature> usesFeatures = Lists.newArrayList();

      for (Manifest m : manifests) {
        usesFeatures.addAll(m.getUsesFeatures());
      }

      return usesFeatures;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ManifestInfo.java

示例13: syncIdeAndProjectAndroidNdk

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
@VisibleForTesting
static void syncIdeAndProjectAndroidNdk(@NotNull final LocalProperties localProperties) {
  File projectAndroidNdkPath = localProperties.getAndroidNdkPath();
  File ideAndroidNdkPath = IdeSdks.getAndroidNdkPath();

  if (projectAndroidNdkPath != null) {
    if (!SdkPaths.validateAndroidNdk(projectAndroidNdkPath, false).success) {
      if (ideAndroidNdkPath != null) {
        Logger.getInstance(SdkSync.class).warn(String.format("Replacing invalid NDK path %1$s with %2$s",
                                                             projectAndroidNdkPath, ideAndroidNdkPath));
        setProjectNdk(localProperties, ideAndroidNdkPath);
      }
      else {
        Logger.getInstance(SdkSync.class).warn(String.format("Removing invalid NDK path: %s", projectAndroidNdkPath));
        setProjectNdk(localProperties, null);
      }
    }
  }
  else {
    setProjectNdk(localProperties, ideAndroidNdkPath);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SdkSync.java

示例14: initComponent

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
@Override
@SuppressWarnings({"StringEquality"})
public void initComponent() {
  final Language xmlLang = StdFileTypes.XML.getLanguage();

  //            intentionManager.addAction(new DeleteUnusedParameterFix());
  //            intentionManager.addAction(new DeleteUnusedVariableFix());

  final XsltFormattingModelBuilder builder = new XsltFormattingModelBuilder(LanguageFormatting.INSTANCE.forLanguage(xmlLang));
  LanguageFormatting.INSTANCE.addExplicitExtension(xmlLang, builder);

  try {
    // TODO: put this into com.intellij.refactoring.actions.IntroduceParameterAction, just like IntroduceVariableAction
    ActionManager.getInstance().getAction("IntroduceParameter").setInjectedContext(true);
  }
  catch (Exception e) {
    Logger.getInstance(XsltConfigImpl.class.getName()).error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:XsltConfigImpl.java

示例15: logAndClose

import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public static void logAndClose(@NotNull Throwable error, @NotNull Logger log, @NotNull Channel channel) {
  // don't report about errors while connecting
  // WEB-7727
  try {
    if (error instanceof ConnectException) {
      log.debug(error);
    }
    else {
      log(error, log);
    }
  }
  finally {
    log.info("Channel will be closed due to error");
    channel.close();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:NettyUtil.java


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