1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
|
3
|
<appenders>
|
4
|
<Console name="console" >
|
5
|
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [${app-name}] [%15.15t] %5p [%-30.30logger{1.}] (%-4L) : %m%n%wEx" />
|
6
|
</Console>
|
7
|
|
8
|
<RollingFile name="service_file" fileName="${log-path}/service/${hostName}.log" filePattern="${log-path}/service/%d{yyyyMMdd}/${hostName}-%i.log">
|
9
|
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [${app-name}] [%15.15t] %5p [%-30.30logger{1.}] (%-4L) : %m%n%wEx" />
|
10
|
<Policies>
|
11
|
<SizeBasedTriggeringPolicy size="500MB" /> <!-- 이 용량이 초과되면 아래 DefaultRolloverStrategy 정책만큼 넘버링 -->
|
12
|
<TimeBasedTriggeringPolicy /><!-- Rotated everyday -->
|
13
|
</Policies>
|
14
|
<DefaultRolloverStrategy max="500" fileIndex="min">
|
15
|
<Delete basePath="${log-path}/service" maxDepth="3">
|
16
|
<IfFileName glob="*.log" />
|
17
|
<IfLastModified age="${log-age}" />
|
18
|
</Delete>
|
19
|
<Delete basePath="${log-path}/service" maxDepth="2">
|
20
|
<ScriptCondition>
|
21
|
<Script name="GroovyCondition" language="groovy"><![CDATA[
|
22
|
import java.nio.file.*
|
23
|
import java.nio.file.attribute.BasicFileAttributes;
|
24
|
import org.apache.logging.log4j.core.appender.rolling.action.PathWithAttributes;
|
25
|
|
26
|
List<PathWithAttributes> result = new ArrayList<PathWithAttributes>();
|
27
|
|
28
|
statusLogger.info 'SCRIPT: Checking for empty folders in base path: ' + basePath
|
29
|
Files.list(basePath).filter(p -> p.toFile().isDirectory()).forEach(p ->{
|
30
|
statusLogger.info 'SCRIPT: Testing if folder is empty: ' + p
|
31
|
try(DirectoryStream<Path> dirStream = Files.newDirectoryStream(p)) {
|
32
|
// is directory empty?
|
33
|
if (!dirStream.iterator().hasNext()) {
|
34
|
statusLogger.info 'SCRIPT: Returning empty folder for deletion: ' + p
|
35
|
// BasicFileAttributes attributes = Files.readAttributes(p, BasicFileAttributes.class);
|
36
|
// result.add(new PathWithAttributes(p, attributes));
|
37
|
Files.delete(p);
|
38
|
}
|
39
|
}
|
40
|
})
|
41
|
|
42
|
return result;
|
43
|
]]>
|
44
|
</Script>
|
45
|
</ScriptCondition>
|
46
|
</Delete>
|
47
|
</DefaultRolloverStrategy>
|
48
|
</RollingFile>
|
49
|
|
50
|
<RollingFile name="access_file" fileName="${log-path}/access/${hostName}-access.log" filePattern="${log-path}/access/%d{yyyyMMdd}/${hostName}-access-%i.log">
|
51
|
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%15.15t] %5p [%-30.30logger{1.}] (%-4L) : %m%n%wEx" />
|
52
|
<Policies>
|
53
|
<SizeBasedTriggeringPolicy size="500MB" /> <!-- 이 용량이 초과되면 아래 DefaultRolloverStrategy 정책만큼 넘버링 -->
|
54
|
<TimeBasedTriggeringPolicy /><!-- Rotated everyday -->
|
55
|
</Policies>
|
56
|
<DefaultRolloverStrategy>
|
57
|
<Delete basePath="${log-path}/access" maxDepth="3">
|
58
|
<IfFileName glob="*.log" />
|
59
|
<IfLastModified age="${log-age}" />
|
60
|
</Delete>
|
61
|
<Delete basePath="${log-path}/access" maxDepth="2">
|
62
|
<ScriptCondition>
|
63
|
<Script name="GroovyCondition" language="groovy"><![CDATA[
|
64
|
import java.nio.file.*
|
65
|
import java.nio.file.attribute.BasicFileAttributes;
|
66
|
import org.apache.logging.log4j.core.appender.rolling.action.PathWithAttributes;
|
67
|
|
68
|
List<PathWithAttributes> result = new ArrayList<PathWithAttributes>();
|
69
|
|
70
|
statusLogger.info 'SCRIPT: Checking for empty folders in base path: ' + basePath
|
71
|
Files.list(basePath).filter(p -> p.toFile().isDirectory()).forEach(p ->{
|
72
|
statusLogger.info 'SCRIPT: Testing if folder is empty: ' + p
|
73
|
try(DirectoryStream<Path> dirStream = Files.newDirectoryStream(p)) {
|
74
|
// is directory empty?
|
75
|
if (!dirStream.iterator().hasNext()) {
|
76
|
statusLogger.info 'SCRIPT: Returning empty folder for deletion: ' + p
|
77
|
// BasicFileAttributes attributes = Files.readAttributes(p, BasicFileAttributes.class);
|
78
|
// result.add(new PathWithAttributes(p, attributes));
|
79
|
Files.delete(p);
|
80
|
}
|
81
|
}
|
82
|
})
|
83
|
|
84
|
return result;
|
85
|
]]>
|
86
|
</Script>
|
87
|
</ScriptCondition>
|
88
|
</Delete>
|
89
|
</DefaultRolloverStrategy>
|
90
|
</RollingFile>
|
91
|
|
92
|
<RollingFile name="alive_file" fileName="${log-path}/alive/${hostName}-alive.log" filePattern="${log-path}/alive/%d{yyyyMMdd}/${hostName}-alive-%i.log">
|
93
|
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %m%n%wEx" />
|
94
|
<Policies>
|
95
|
<SizeBasedTriggeringPolicy size="500MB" /> <!-- 이 용량이 초과되면 아래 DefaultRolloverStrategy 정책만큼 넘버링 -->
|
96
|
<TimeBasedTriggeringPolicy /><!-- Rotated everyday -->
|
97
|
</Policies>
|
98
|
<DefaultRolloverStrategy>
|
99
|
<Delete basePath="${log-path}/alive" maxDepth="3">
|
100
|
<IfFileName glob="*.log" />
|
101
|
<IfLastModified age="${log-age}" />
|
102
|
</Delete>
|
103
|
<Delete basePath="${log-path}/alive" maxDepth="2">
|
104
|
<ScriptCondition>
|
105
|
<Script name="GroovyCondition" language="groovy"><![CDATA[
|
106
|
import java.nio.file.*
|
107
|
import java.nio.file.attribute.BasicFileAttributes;
|
108
|
import org.apache.logging.log4j.core.appender.rolling.action.PathWithAttributes;
|
109
|
|
110
|
List<PathWithAttributes> result = new ArrayList<PathWithAttributes>();
|
111
|
|
112
|
statusLogger.info 'SCRIPT: Checking for empty folders in base path: ' + basePath
|
113
|
Files.list(basePath).filter(p -> p.toFile().isDirectory()).forEach(p ->{
|
114
|
statusLogger.info 'SCRIPT: Testing if folder is empty: ' + p
|
115
|
try(DirectoryStream<Path> dirStream = Files.newDirectoryStream(p)) {
|
116
|
// is directory empty?
|
117
|
if (!dirStream.iterator().hasNext()) {
|
118
|
statusLogger.info 'SCRIPT: Returning empty folder for deletion: ' + p
|
119
|
// BasicFileAttributes attributes = Files.readAttributes(p, BasicFileAttributes.class);
|
120
|
// result.add(new PathWithAttributes(p, attributes));
|
121
|
Files.delete(p);
|
122
|
}
|
123
|
}
|
124
|
})
|
125
|
|
126
|
return result;
|
127
|
]]>
|
128
|
</Script>
|
129
|
</ScriptCondition>
|
130
|
</Delete>
|
131
|
</DefaultRolloverStrategy>
|
132
|
</RollingFile>
|
133
|
|
134
|
<RollingFile name="error_file" fileName="${log-path}/error/${hostName}-error.log" filePattern="${log-path}/error/$${date:yyyyMMdd}/${hostName}-error-%i.log">
|
135
|
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [${hostName}] [%20.20t] [%-40.40logger{39}] (%-4L) : %m%n%wEx" />
|
136
|
<Policies>
|
137
|
<CronTriggeringPolicy schedule="0 0 0 * * ?" />
|
138
|
</Policies>
|
139
|
<DefaultRolloverStrategy>
|
140
|
<Delete basePath="${log-path}/error" maxDepth="3">
|
141
|
<IfFileName glob="*.log" />
|
142
|
<IfLastModified age="${log-age}" />
|
143
|
</Delete>
|
144
|
<Delete basePath="${log-path}/error" maxDepth="2">
|
145
|
<ScriptCondition>
|
146
|
<Script name="GroovyCondition" language="groovy"><![CDATA[
|
147
|
import java.nio.file.*
|
148
|
import java.nio.file.attribute.BasicFileAttributes;
|
149
|
import org.apache.logging.log4j.core.appender.rolling.action.PathWithAttributes;
|
150
|
|
151
|
List<PathWithAttributes> result = new ArrayList<PathWithAttributes>();
|
152
|
|
153
|
statusLogger.info 'SCRIPT: Checking for empty folders in base path: ' + basePath
|
154
|
Files.list(basePath).filter(p -> p.toFile().isDirectory()).forEach(p ->{
|
155
|
statusLogger.info 'SCRIPT: Testing if folder is empty: ' + p
|
156
|
try(DirectoryStream<Path> dirStream = Files.newDirectoryStream(p)) {
|
157
|
// is directory empty?
|
158
|
if (!dirStream.iterator().hasNext()) {
|
159
|
statusLogger.info 'SCRIPT: Returning empty folder for deletion: ' + p
|
160
|
// BasicFileAttributes attributes = Files.readAttributes(p, BasicFileAttributes.class);
|
161
|
// result.add(new PathWithAttributes(p, attributes));
|
162
|
Files.delete(p);
|
163
|
}
|
164
|
}
|
165
|
})
|
166
|
|
167
|
return result;
|
168
|
]]>
|
169
|
</Script>
|
170
|
</ScriptCondition>
|
171
|
</Delete>
|
172
|
</DefaultRolloverStrategy>
|
173
|
</RollingFile>
|
174
|
|
175
|
<Routing name="routing_csv_file">
|
176
|
<Routes pattern="${ctx:csvDataPath}/${ctx:csvFileName}">
|
177
|
<Route>
|
178
|
<RollingFile name="rolling"
|
179
|
fileName="${ctx:csvDataPath}/${ctx:csvFileName}-0.csv"
|
180
|
filePattern="${ctx:csvDataPath}/${ctx:csvFileName}-%i.csv">
|
181
|
<CsvParameterLayout delimiter="," format="Excel" charset="UTF-8" />
|
182
|
<Policies>
|
183
|
<SizeBasedTriggeringPolicy size="500MB" />
|
184
|
</Policies>
|
185
|
<DefaultRolloverStrategy max="200" />
|
186
|
</RollingFile>
|
187
|
</Route>
|
188
|
</Routes>
|
189
|
</Routing>
|
190
|
|
191
|
</appenders>
|