Skip to content

Commit ed4b7cd

Browse files
committed
2019-12-17 - Initial Version
1 parent 65aa3eb commit ed4b7cd

8 files changed

Lines changed: 534 additions & 0 deletions

File tree

WatchLogFile.iml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
4+
<output url="file://$MODULE_DIR$/target/classes" />
5+
<output-test url="file://$MODULE_DIR$/target/test-classes" />
6+
<content url="file://$MODULE_DIR$">
7+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8+
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9+
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
10+
<excludeFolder url="file://$MODULE_DIR$/target" />
11+
</content>
12+
<orderEntry type="inheritedJdk" />
13+
<orderEntry type="sourceFolder" forTests="false" />
14+
<orderEntry type="module-library">
15+
<library>
16+
<CLASSES>
17+
<root url="file://$MODULE_DIR$/commons-io-2.6" />
18+
</CLASSES>
19+
<JAVADOC>
20+
<root url="file://$MODULE_DIR$/commons-io-2.6/docs" />
21+
</JAVADOC>
22+
<SOURCES>
23+
<root url="file://$MODULE_DIR$/commons-io-2.6" />
24+
</SOURCES>
25+
<jarDirectory url="file://$MODULE_DIR$/commons-io-2.6" recursive="false" />
26+
<jarDirectory url="file://$MODULE_DIR$/commons-io-2.6" recursive="false" type="SOURCES" />
27+
</library>
28+
</orderEntry>
29+
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
30+
</component>
31+
</module>

logs/app.log

Lines changed: 266 additions & 0 deletions
Large diffs are not rendered by default.

logs/debug.log

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
2019-11-25 13:12:11,625 [DEBUG ] Main – Hello from Log4j 2
2+
2019-11-25 13:12:11,628 [DIAG ] Main – a diagnostic message
3+
2019-11-25 13:12:11,628 [NOTICE] Main – another diagnostic message
4+
2019-11-25 13:12:11,629 [FATAL ] Main – Logger Name :: com.faustobranco.Main :: Passed Message ::
5+
2019-11-25 13:12:11,629 [DEBUG ] Main – {}
6+
2019-11-25 13:12:11,630 [DEBUG ] Main – the built-in DEBUG level
7+
2019-11-25 13:12:11,630 [INFO ] Main – the built-in INFO level
8+
2019-11-25 13:12:11,630 [WARN ] Main – the built-in WARN level
9+
2019-11-25 13:12:11,630 [ERROR ] Main – the built-in ERROR level
10+
2019-11-25 13:12:11,631 [FATAL ] Main – the built-in FATAL level
11+
2019-11-25 13:12:32,160 [DEBUG ] Main – Hello from Log4j 2
12+
2019-11-25 13:12:32,166 [DIAG ] Main – a diagnostic message
13+
2019-11-25 13:12:32,166 [NOTICE] Main – another diagnostic message
14+
2019-11-25 13:12:32,166 [FATAL ] Main – Logger Name :: com.faustobranco.Main :: Passed Message ::
15+
2019-11-25 13:12:32,166 [DEBUG ] Main – {}
16+
2019-11-25 13:12:32,167 [DEBUG ] Main – the built-in DEBUG level
17+
2019-11-25 13:12:32,167 [INFO ] Main – the built-in INFO level
18+
2019-11-25 13:12:32,167 [WARN ] Main – the built-in WARN level
19+
2019-11-25 13:12:32,167 [ERROR ] Main – the built-in ERROR level
20+
2019-11-25 13:12:32,167 [FATAL ] Main – the built-in FATAL level
21+
2019-11-25 13:13:37,589 [DEBUG ] Main – Hello from Log4j 2
22+
2019-11-25 13:13:37,593 [DIAG ] Main – a diagnostic message
23+
2019-11-25 13:13:37,594 [NOTICE] Main – another diagnostic message
24+
2019-11-25 13:13:37,594 [FATAL ] Main – Logger Name :: com.faustobranco.Main :: Passed Message ::
25+
2019-11-25 13:13:37,595 [DEBUG ] Main – {}
26+
2019-11-25 13:13:37,595 [DEBUG ] Main – the built-in DEBUG level
27+
2019-11-25 13:13:37,595 [INFO ] Main – the built-in INFO level
28+
2019-11-25 13:13:37,595 [WARN ] Main – the built-in WARN level
29+
2019-11-25 13:13:37,595 [ERROR ] Main – the built-in ERROR level
30+
2019-11-25 13:13:37,595 [FATAL ] Main – the built-in FATAL level
31+
2019-11-25 13:19:01,077 [DEBUG ] Main – Hello from Log4j 2
32+
2019-11-25 13:19:01,079 [DEBUG ] Main – {}
33+
2019-11-25 13:19:01,079 [DEBUG ] Main – the built-in DEBUG level
34+
2019-11-25 13:21:59,633 [DEBUG ] Main – Hello from Log4j 2
35+
2019-11-25 13:21:59,636 [DIAG ] Main – a diagnostic message
36+
2019-11-25 13:21:59,637 [NOTICE] Main – another diagnostic message
37+
2019-11-25 13:21:59,638 [DEBUG ] Main – {}
38+
2019-11-25 13:21:59,638 [DEBUG ] Main – the built-in DEBUG level
39+
2019-11-25 13:21:59,638 [INFO ] Main – the built-in INFO level
40+
2019-11-25 13:21:59,639 [WARN ] Main – the built-in WARN level
41+
2019-11-25 13:21:59,639 [ERROR ] Main – the built-in ERROR level
42+
2019-11-25 13:22:32,554 [DEBUG ] Main – Hello from Log4j 2
43+
2019-11-25 13:22:32,557 [DIAG ] Main – a diagnostic message
44+
2019-11-25 13:22:32,559 [NOTICE] Main – another diagnostic message
45+
2019-11-25 13:22:32,559 [FATAL ] Main – Logger Name :: com.faustobranco.Main :: Passed Message ::
46+
2019-11-25 13:22:32,559 [DEBUG ] Main – {}
47+
2019-11-25 13:22:32,559 [DEBUG ] Main – the built-in DEBUG level
48+
2019-11-25 13:22:32,559 [INFO ] Main – the built-in INFO level
49+
2019-11-25 13:22:32,560 [WARN ] Main – the built-in WARN level
50+
2019-11-25 13:22:32,560 [ERROR ] Main – the built-in ERROR level
51+
2019-11-25 13:22:32,560 [FATAL ] Main – the built-in FATAL level
52+
2019-11-25 13:22:47,828 [DEBUG ] Main – Hello from Log4j 2
53+
2019-11-25 13:22:47,835 [DIAG ] Main – a diagnostic message
54+
2019-11-25 13:22:47,837 [NOTICE] Main – another diagnostic message
55+
2019-11-25 13:22:47,837 [FATAL ] Main – Logger Name :: com.faustobranco.Main :: Passed Message ::
56+
2019-11-25 13:22:47,837 [DEBUG ] Main – {}
57+
2019-11-25 13:22:47,839 [DEBUG ] Main – the built-in DEBUG level
58+
2019-11-25 13:22:47,840 [INFO ] Main – the built-in INFO level
59+
2019-11-25 13:22:47,840 [WARN ] Main – the built-in WARN level
60+
2019-11-25 13:22:47,840 [ERROR ] Main – the built-in ERROR level
61+
2019-11-25 13:22:47,841 [FATAL ] Main – the built-in FATAL level
62+
2019-11-25 13:23:02,636 [DEBUG ] Main – Hello from Log4j 2
63+
2019-11-25 13:23:02,639 [DIAG ] Main – a diagnostic message
64+
2019-11-25 13:23:02,640 [NOTICE] Main – another diagnostic message
65+
2019-11-25 13:23:02,641 [DEBUG ] Main – {}
66+
2019-11-25 13:23:02,641 [DEBUG ] Main – the built-in DEBUG level
67+
2019-11-25 13:23:02,641 [INFO ] Main – the built-in INFO level
68+
2019-11-25 13:23:02,641 [WARN ] Main – the built-in WARN level
69+
2019-11-25 13:23:02,642 [ERROR ] Main – the built-in ERROR level
70+
2019-11-25 13:23:32,570 [DEBUG ] Main – Hello from Log4j 2
71+
2019-11-25 13:23:32,573 [DIAG ] Main – a diagnostic message
72+
2019-11-25 13:23:32,575 [NOTICE] Main – another diagnostic message
73+
2019-11-25 13:23:32,575 [DEBUG ] Main – {}
74+
2019-11-25 13:23:32,575 [DEBUG ] Main – the built-in DEBUG level
75+
2019-11-25 13:23:32,575 [INFO ] Main – the built-in INFO level
76+
2019-11-25 13:23:32,575 [WARN ] Main – the built-in WARN level
77+
2019-11-25 13:23:32,576 [ERROR ] Main – the built-in ERROR level
78+
2019-11-25 13:24:41,490 [DEBUG ] Main – Hello from Log4j 2
79+
2019-11-25 13:24:41,493 [DIAG ] Main – a diagnostic message
80+
2019-11-25 13:24:41,493 [NOTICE] Main – another diagnostic message
81+
2019-11-25 13:24:41,494 [DEBUG ] Main – {}
82+
2019-11-25 13:24:41,494 [DEBUG ] Main – the built-in DEBUG level
83+
2019-11-25 13:24:41,494 [INFO ] Main – the built-in INFO level
84+
2019-11-25 13:24:41,494 [WARN ] Main – the built-in WARN level
85+
2019-11-25 13:24:41,494 [ERROR ] Main – the built-in ERROR level
86+
2019-11-25 13:24:50,414 [DEBUG ] Main – Hello from Log4j 2
87+
2019-11-25 13:24:50,417 [DIAG ] Main – a diagnostic message
88+
2019-11-25 13:24:50,417 [NOTICE] Main – another diagnostic message
89+
2019-11-25 13:24:50,418 [DEBUG ] Main – {}
90+
2019-11-25 13:24:50,418 [DEBUG ] Main – the built-in DEBUG level
91+
2019-11-25 13:24:50,418 [INFO ] Main – the built-in INFO level
92+
2019-11-25 13:24:50,418 [WARN ] Main – the built-in WARN level
93+
2019-11-25 13:24:50,418 [ERROR ] Main – the built-in ERROR level
94+
2019-11-25 13:25:12,896 [DEBUG ] Main – Hello from Log4j 2
95+
2019-11-25 13:25:12,899 [DIAG ] Main – a diagnostic message
96+
2019-11-25 13:25:12,900 [NOTICE] Main – another diagnostic message
97+
2019-11-25 13:25:12,900 [DEBUG ] Main – {}
98+
2019-11-25 13:25:12,900 [DEBUG ] Main – the built-in DEBUG level
99+
2019-11-25 13:25:12,900 [INFO ] Main – the built-in INFO level
100+
2019-11-25 13:25:12,900 [WARN ] Main – the built-in WARN level
101+
2019-11-25 13:25:12,901 [ERROR ] Main – the built-in ERROR level
102+
2019-11-25 13:25:28,371 [DEBUG ] Main – Hello from Log4j 2
103+
2019-11-25 13:25:28,373 [DIAG ] Main – a diagnostic message
104+
2019-11-25 13:25:28,374 [NOTICE] Main – another diagnostic message
105+
2019-11-25 13:25:28,374 [FATAL ] Main – Logger Name :: com.faustobranco.Main :: Passed Message ::
106+
2019-11-25 13:25:28,374 [DEBUG ] Main – {}
107+
2019-11-25 13:25:28,374 [DEBUG ] Main – the built-in DEBUG level
108+
2019-11-25 13:25:28,374 [INFO ] Main – the built-in INFO level
109+
2019-11-25 13:25:28,374 [WARN ] Main – the built-in WARN level
110+
2019-11-25 13:25:28,376 [ERROR ] Main – the built-in ERROR level
111+
2019-11-25 13:25:28,377 [FATAL ] Main – the built-in FATAL level
112+
2019-11-25 13:26:07,489 [DEBUG ] Main – Hello from Log4j 2
113+
2019-11-25 13:26:07,494 [DIAG ] Main – a diagnostic message
114+
2019-11-25 13:26:07,498 [NOTICE] Main – another diagnostic message
115+
2019-11-25 13:26:07,498 [FATAL ] Main – Logger Name :: com.faustobranco.Main :: Passed Message ::
116+
2019-11-25 13:26:07,499 [DEBUG ] Main – {}
117+
2019-11-25 13:26:07,499 [DEBUG ] Main – the built-in DEBUG level
118+
2019-11-25 13:26:07,499 [INFO ] Main – the built-in INFO level
119+
2019-11-25 13:26:07,500 [WARN ] Main – the built-in WARN level
120+
2019-11-25 13:26:07,500 [ERROR ] Main – the built-in ERROR level
121+
2019-11-25 13:26:07,500 [FATAL ] Main – the built-in FATAL level
122+
2019-11-25 13:26:17,064 [DEBUG ] Main – Hello from Log4j 2
123+
2019-11-25 13:26:17,067 [DIAG ] Main – a diagnostic message
124+
2019-11-25 13:26:17,067 [NOTICE] Main – another diagnostic message
125+
2019-11-25 13:26:17,068 [FATAL ] Main – Logger Name :: com.faustobranco.Main :: Passed Message ::
126+
2019-11-25 13:26:17,068 [DEBUG ] Main – {}
127+
2019-11-25 13:26:17,068 [DEBUG ] Main – the built-in DEBUG level
128+
2019-11-25 13:26:17,068 [INFO ] Main – the built-in INFO level
129+
2019-11-25 13:26:17,068 [WARN ] Main – the built-in WARN level
130+
2019-11-25 13:26:17,069 [ERROR ] Main – the built-in ERROR level
131+
2019-11-25 13:26:17,069 [FATAL ] Main – the built-in FATAL level
132+
2019-11-25 13:26:47,243 [DEBUG ] Main – Hello from Log4j 2
133+
2019-11-25 13:26:47,253 [DIAG ] Main – a diagnostic message
134+
2019-11-25 13:26:47,253 [NOTICE] Main – another diagnostic message
135+
2019-11-25 13:26:47,253 [FATAL ] Main – Logger Name :: com.faustobranco.Main :: Passed Message ::
136+
2019-11-25 13:26:47,253 [DEBUG ] Main – {}
137+
2019-11-25 13:26:47,254 [TRACE ] Main – the built-in TRACE level
138+
2019-11-25 13:26:47,254 [DEBUG ] Main – the built-in DEBUG level
139+
2019-11-25 13:26:47,254 [INFO ] Main – the built-in INFO level
140+
2019-11-25 13:26:47,255 [WARN ] Main – the built-in WARN level
141+
2019-11-25 13:26:47,255 [ERROR ] Main – the built-in ERROR level
142+
2019-11-25 13:26:47,255 [FATAL ] Main – the built-in FATAL level
143+
2019-11-25 13:27:15,034 [DEBUG ] Main – Hello from Log4j 2
144+
2019-11-25 13:27:15,037 [DEBUG ] Main – {}
145+
2019-11-25 13:27:15,037 [TRACE ] Main – the built-in TRACE level
146+
2019-11-25 13:27:15,037 [DEBUG ] Main – the built-in DEBUG level
147+
2019-11-25 13:27:23,607 [DEBUG ] Main – Hello from Log4j 2
148+
2019-11-25 13:27:23,610 [DEBUG ] Main – {}
149+
2019-11-25 13:27:23,610 [TRACE ] Main – the built-in TRACE level
150+
2019-11-25 13:27:23,610 [DEBUG ] Main – the built-in DEBUG level
151+
2019-11-25 13:52:50,478 [DEBUG ] Main – Hello from Log4j 2
152+
2019-11-25 13:52:50,487 [DEBUG ] Main – {}
153+
2019-11-25 13:52:50,487 [TRACE ] Main – the built-in TRACE level
154+
2019-11-25 13:52:50,487 [DEBUG ] Main – the built-in DEBUG level
155+
2019-11-25 13:53:03,113 [DEBUG ] Main – Hello from Log4j 2
156+
2019-11-25 13:53:03,119 [DEBUG ] Main – {}
157+
2019-11-25 13:53:03,119 [TRACE ] Main – the built-in TRACE level
158+
2019-11-25 13:53:03,119 [DEBUG ] Main – the built-in DEBUG level
159+
2019-11-25 13:54:31,936 [DEBUG ] Main – Hello from Log4j 2
160+
2019-11-25 13:54:31,942 [DEBUG ] Main – {}
161+
2019-11-25 13:54:31,942 [TRACE ] Main – the built-in TRACE level
162+
2019-11-25 13:54:31,942 [DEBUG ] Main – the built-in DEBUG level
163+
2019-11-25 13:54:54,193 [DEBUG ] Main – Hello from Log4j 2
164+
2019-11-25 13:54:54,197 [DEBUG ] Main – {}
165+
2019-11-25 13:54:54,198 [TRACE ] Main – the built-in TRACE level
166+
2019-11-25 13:54:54,198 [DEBUG ] Main – the built-in DEBUG level
167+
2019-11-25 13:55:54,824 [DEBUG ] Main – Hello from Log4j 2
168+
2019-11-25 13:55:54,827 [DEBUG ] Main – {}
169+
2019-11-25 13:55:54,827 [TRACE ] Main – the built-in TRACE level
170+
2019-11-25 13:55:54,827 [DEBUG ] Main – the built-in DEBUG level
171+
2019-11-25 13:56:08,253 [DEBUG ] Main – Hello from Log4j 2
172+
2019-11-25 13:56:08,261 [DEBUG ] Main – {}
173+
2019-11-25 13:56:08,261 [TRACE ] Main – the built-in TRACE level
174+
2019-11-25 13:56:08,261 [DEBUG ] Main – the built-in DEBUG level
175+
2019-11-25 13:56:21,034 [DEBUG ] Main – Hello from Log4j 2
176+
2019-11-25 13:56:21,078 [DEBUG ] Main – {}
177+
2019-11-25 13:56:21,078 [TRACE ] Main – the built-in TRACE level
178+
2019-11-25 13:56:21,078 [DEBUG ] Main – the built-in DEBUG level
179+
2019-11-25 13:54:54,197 [NOTICE] Main – another diagnostic message

pom.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>groupId</groupId>
8+
<artifactId>WatchLogFile</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<dependencies>
11+
<dependency>
12+
<groupId>commons-io</groupId>
13+
<artifactId>commons-io</artifactId>
14+
<version>2.6</version>
15+
</dependency>
16+
</dependencies>
17+
<build>
18+
<plugins>
19+
<plugin>
20+
<groupId>org.apache.maven.plugins</groupId>
21+
<artifactId>maven-compiler-plugin</artifactId>
22+
<configuration>
23+
<source>1.8</source>
24+
<target>1.8</target>
25+
</configuration>
26+
</plugin>
27+
</plugins>
28+
</build>
29+
</project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.faustobranco;
2+
// org.apache.commons.io.input
3+
import java.io.*;
4+
import org.apache.commons.io.input.Tailer;
5+
import org.apache.commons.io.input.TailerListenerAdapter;
6+
7+
public class Main {
8+
9+
10+
private static final int SLEEP = 500;
11+
12+
public static void main(String[] args) throws Exception {
13+
MyListener listener = new MyListener();
14+
Tailer tailer_app = Tailer.create(new File("logs/app.log"), listener, SLEEP);
15+
Tailer tailer_debug = Tailer.create(new File("logs/debug.log"), listener, SLEEP);
16+
while (true) {
17+
Thread.sleep(SLEEP);
18+
}
19+
}
20+
21+
public static class MyListener extends TailerListenerAdapter {
22+
23+
@Override
24+
public void handle(String line) {
25+
System.out.println(line);
26+
}
27+
28+
}
29+
}
16 Bytes
Binary file not shown.
643 Bytes
Binary file not shown.
1.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)