Скрыть запросы API (YahooFinance) в отладчике кода Java Visual Studio - PullRequest
0 голосов
/ 16 ноября 2018

У меня проблемы с удалением оранжевых java API-запросов в терминале отладчика.Я хочу скрыть это.Как мне это сделать?(см. рисунок)

Я использую код Visual Studio с maven.

Printscreen

Мой фрагмент кода:

        try {


    Calendar from = Calendar.getInstance();
    Calendar to = Calendar.getInstance();
    from.add(Calendar.YEAR, -1); // from 1 year ago 
    Stock stock = YahooFinance.get("GOOG");
    List<HistoricalQuote> stockHistQuotes = stock.getHistory(from, to, Interval.DAILY);

}

 catch(Exception e) {}

Вывод:

Hello World!
358 [main] INFO yahoofinance.quotes.query1v7.QuotesRequest - Sending request: https://query1.finance.yahoo.com/v7/finance/quote?symbols=GOOG
3687 [main] INFO yahoofinance.histquotes2.HistQuotes2Request - Sending request: https://query1.finance.yahoo.com/v7/finance/download/GOOG?period1=1510830000&period2=1542366000&interval=1d&crumb=FlUQht4hFF9
3756 [main] INFO yahoofinance.histquotes2.HistQuotes2Request - Parsing CSV line: 2017-11-16,1022.520020,1035.920044,1022.520020,1032.500000,1032.500000,1129700
3758 [main] INFO yahoofinance.histquotes2.HistQuotes2Request - Parsing CSV line: 2017-11-17,1034.010010,1034.420044,1017.750000,1019.090027,1019.090027,1397100
3758 [main] INFO yahoofinance.histquotes2.HistQuotes2Request - Parsing CSV line: 2017-11-20,1020.260010,1022.609985,1017.500000,1018.380005,1018.380005,953500

Все, кроме Hello World, должно быть удалено.

1 Ответ

0 голосов
/ 16 ноября 2018

Спасибо, я решил с помощью этой строки кода:

Configurator.setRootLevel(Level.FATAL);

И изменил мои зависимости в Maven на:

 <exclusions>
      <exclusion>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
      </exclusion>
      <exclusion>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
      </exclusion>
    </exclusions>
  <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.11.1</version>
  </dependency>
  <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-slf4j-impl</artifactId>
    <version>2.11.1</version>
  </dependency>
  <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-1.2-api</artifactId>
    <version>2.11.1</version>
  </dependency>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...