package com.hxh.spring.test;
|
|
import org.junit.Test;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
|
import java.io.FileInputStream;
|
import java.io.FileNotFoundException;
|
import java.util.Scanner;
|
|
public class LogTest {
|
|
private final static Logger logger = LoggerFactory.getLogger(LogTest.class);
|
|
@Test
|
public void testLog() throws FileNotFoundException {
|
int count = 0;
|
String path = "";
|
Scanner scanner = new Scanner(new FileInputStream("C:\\Users\\Administrator\\Desktop\\日志\\布丸播放\\video_play.2021-03-05.log"));
|
while (scanner.hasNextLine()) {
|
String text = scanner.nextLine();
|
if (text != null && text.contains("getVideoDetail:")) {
|
count++;
|
}
|
}
|
scanner.close();
|
System.out.println(count);
|
}
|
}
|