admin
2025-02-20 f537abe9f3646c739beaf15076246a2f71a347e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.hxh.spring.test.log;
 
import org.junit.Test;
 
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;
 
/**
 * @author Administrator
 * @title: LogTest
 * @description: TODO
 * @date 2021/10/11 14:46
 */
public class LogTest {
 
    @Test
    public void access() throws FileNotFoundException {
 
        Scanner scanner = new Scanner(new FileInputStream(new File("C:\\Users\\Administrator\\Downloads\\202110111057018682009979\\localhost_access_log.2021-10-11.txt")));
        while (scanner.hasNextLine()) {
            String content = scanner.nextLine();
            if (content.contains("comment")) {
                System.out.println(content);
            }
        }
        scanner.close();
 
    }
 
 
}