當前位置: 首頁>>代碼示例>>Java>>正文


Java Logger.debug方法代碼示例

本文整理匯總了Java中com.intellij.openapi.diagnostic.Logger.debug方法的典型用法代碼示例。如果您正苦於以下問題:Java Logger.debug方法的具體用法?Java Logger.debug怎麽用?Java Logger.debug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.diagnostic.Logger的用法示例。


在下文中一共展示了Logger.debug方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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

示例3: prettyFormatResponseToLog

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
public static void prettyFormatResponseToLog(@NotNull Logger logger, @NotNull HttpResponse response) {
  if (logger.isDebugEnabled()) {
    try {
      String content = TaskResponseUtil.getResponseContentAsString(response);
      org.apache.http.Header header = response.getEntity().getContentType();
      String contentType = header == null ? "text/plain" : header.getElements()[0].getName().toLowerCase(Locale.ENGLISH);
      if (contentType.contains("xml")) {
        prettyFormatXmlToLog(logger, content);
      }
      else if (contentType.contains("json")) {
        prettyFormatJsonToLog(logger, content);
      }
      else {
        logger.debug(content);
      }
    }
    catch (IOException e) {
      logger.error(e);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:TaskUtil.java

示例4: getPlatformNotifier

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
private static Notifier getPlatformNotifier() {
  try {
    if (SystemInfo.isMac) {
      if (SystemInfo.isMacOSMountainLion && Registry.is("ide.mac.mountain.lion.notifications.enabled")) {
        return MountainLionNotifications.getInstance();
      }
      if (!Boolean.getBoolean("growl.disable")) {
        return GrowlNotifications.getInstance();
      }
    }

    if (SystemInfo.isXWindow && Registry.is("ide.libnotify.enabled") ) {
      return LibNotifyWrapper.getInstance();
    }
  }
  catch (Throwable t) {
    Logger logger = Logger.getInstance(SystemNotifications.class);
    if (logger.isDebugEnabled()) {
      logger.debug(t);
    }
    else {
      logger.info(t.getMessage());
    }
  }

  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:SystemNotificationsImpl.java

示例5: prettyFormatXmlToLog

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
/**
 * Print pretty-formatted XML to {@code logger}, if its level is DEBUG or below.
 */
public static void prettyFormatXmlToLog(@NotNull Logger logger, @NotNull Element element) {
  if (logger.isDebugEnabled()) {
    // alternatively
    //new XMLOutputter(Format.getPrettyFormat()).outputString(root)
    logger.debug("\n" + JDOMUtil.createOutputter("\n").outputString(element));
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:TaskUtil.java

示例6: prettyFormatJsonToLog

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
/**
 * Parse and print pretty-formatted Json to {@code logger}, if its level is DEBUG or below.
 */
public static void prettyFormatJsonToLog(@NotNull Logger logger, @NotNull String json) {
  if (logger.isDebugEnabled()) {
    try {
      Gson gson = new GsonBuilder().setPrettyPrinting().create();
      logger.debug("\n" + gson.toJson(gson.fromJson(json, JsonElement.class)));
    }
    catch (JsonSyntaxException e) {
      logger.debug("Malformed JSON\n" + json);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:TaskUtil.java

示例7: log

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
private static void log(String format, Object... args) {
  Logger logger = Logger.getInstance(SocketLock.class);
  if (logger.isDebugEnabled()) {
    logger.debug(String.format(format, args));
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:SocketLock.java

示例8: RareLogger

import com.intellij.openapi.diagnostic.Logger; //導入方法依賴的package包/類
private RareLogger(final Logger logger, final boolean fairSynch) {
  myLogger = logger;

  final Object lock = new Object();
  myCache = new SLRUMap<Object, Long>(64, 32) {
    @Override
    public Long get(Object key) {
      if (fairSynch) {
        synchronized (lock) {
          return super.get(key);
        }
      }
      return super.get(key);
    }

    @Override
    public void put(Object key, @NotNull Long value) {
      if (fairSynch) {
        synchronized (lock) {
          super.put(key, value);
          return;
        }
      }
      super.put(key, value);
    }

    @Override
    public boolean remove(Object key) {
      if (fairSynch) {
        synchronized (lock) {
          return super.remove(key);
        }
      }
      return super.remove(key);
    }
  };
  myConvertors = new LinkedList<LogFilter>();

  // just passes to parent logger
  myProxy = new LogFilter() {
    @Override
    @NotNull
    public Integer getAllowedLoggingInterval(Level level, String message, Throwable t, String[] details) {
      return -1;
    }
    @Override
    public Object getKey(@NotNull Level level,
                         @NonNls String message,
                         @Nullable Throwable t,
                         @NonNls String... details) {
      if (Level.DEBUG.equals(level)) {
        logger.debug(message, t);
      } else if (Level.INFO.equals(level)) {
        logger.info(message, t);
      } else if (Level.WARN.equals(level)) {
        logger.warn(message, t);
      } else if (Level.ERROR.equals(level)) {
        logger.error(message, t, details);
      }
      return null;
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:64,代碼來源:RareLogger.java


注:本文中的com.intellij.openapi.diagnostic.Logger.debug方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。