forked from WorldBank-Transport/Transitime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogback.xml
More file actions
391 lines (340 loc) · 14.8 KB
/
Copy pathlogback.xml
File metadata and controls
391 lines (340 loc) · 14.8 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
<!-- This is the configuration file for the logback logging system. This file
will be used if it is in the classpath (because logback looks for the file
logback.xml in the classpath) or if explicitly invoked using the
Java param -Dlogback.configurationFile=/DIR/src/main/config/logback.xml
(testing from eclipse)
-->
<!-- Note that scanPeriod is set to 30 seconds so that config file will
be automatically reloaded if needed and take effect every 30 seconds.
-->
<configuration scan="true" scanPeriod="30 seconds" >
<!-- Set properties here. NOTE: it is expected that the property
-Dtransitime.core.agencyId=xx will be set. Also, if want logging
to use the proper timezone then need to set the timezone property
to something like -Dlogback.timezone=America/Los_Angeles . Valid
timezone format is at http://en.wikipedia.org/wiki/List_of_tz_zones
-->
<property name="LOG_FILE_ROOT"
value="${transitime.logging.dir:-/Logs}/${transitime.core.agencyId:-DEFAULT}/core/%d{yyyy/MM/dd}" />
<!-- The pattern layout how the log file should log info is set here. Note that
a newline is used at beginning so that there is a blank line between
each entry. Newline needs to be at beginning so stack traces for exceptions
are displayed properly since they are displayed after the message.
Info on layouts is out http://logback.qos.ch/manual/layouts.html .
The timezone for logging is set using the Java property
-Dlogback.timezone=America/New_York or such. Timezone formats are described
at http://en.wikipedia.org/wiki/List_of_tz_zones .
-->
<property name="DEFAULT_PATTERN"
value="%n%d{HH:mm:ss.SSS, ${logback.timezone:-America/Los_Angeles}} %-5level thread=%t [%logger{10}:%line] %msg%n" />
<property name="DEBUG_PATTERN"
value="%n%d{HH:mm:ss.SSS, ${logback.timezone:-America/Los_Angeles}} %-5level thread=%t [%logger{10}:%line] %msg%n" />
<property name="DATA_PATTERN" value="%n%d{HH:mm:ss.SSS, ${logback.timezone:-America/Los_Angeles}} %msg%n" />
<!-- For logging to stdout logback status message for when logback is initializing
-->
<!-- <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> -->
<!-- The main appender for the Core module. use a RollingFileAppender
so that can store log files in a calendar based directory structure
logs/agency/yyyy/MM/dd/logFile.log .
C:/Users/Mike/git/testProject/testProject/logs... The log file
is called "core.log". The files are rolled over at
midnight since "dd" specify that logs should be dealt with daily.
Logs are compressed automatically since "gz" specified.
-->
<appender name="CORE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover. Compress the file when rolling it over.
-->
<fileNamePattern>${LOG_FILE_ROOT}/core.log.gz</fileNamePattern>
</rollingPolicy>
<!-- Only want this appender to take effect if not DEBUG level. This
way when DEBUG level the CORE_DEBUG can instead handle things
and use more verbose logging that could be useful for debugging.
-->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>DEBUG</level>
<onMatch>DENY</onMatch>
<onMismatch>ACCEPT</onMismatch>
</filter>
<encoder>
<!-- Info on possible patterns is at
http://logback.qos.ch/manual/layouts.html#ClassicPatternLayout
-->
<charset>UTF-8</charset>
<pattern>${DEFAULT_PATTERN}</pattern>
</encoder>
</appender>
<!-- For debugging probably want to log additional info so the
pattern is enhanced. Otherwise it should be identical to
the CORE appender.
-->
<appender name="CORE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover. Compress the file when rolling it over.
-->
<fileNamePattern>${LOG_FILE_ROOT}/core.log.gz</fileNamePattern>
</rollingPolicy>
<!-- Only want this appender to take effect if DEBUG level. This
way when DEBUG level this CORE_DEBUG appender can handle things
and use more verbose logging that could be useful for debugging.
-->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>DEBUG</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<encoder>
<!-- A more complete pattern that provides additional info for debugging.
-->
<charset>UTF-8</charset>
<pattern>${DEBUG_PATTERN}</pattern>
</encoder>
</appender>
<!-- For sending out e-mails when there is an logging message that is marked
for notification. Usually, but not necessarily always, this will be
and ERROR level message.
-->
<appender name="ERROR_SMTP" class="ch.qos.logback.classic.net.SMTPAppender">
<!-- LIST ALL E-MAIL ADDRESS HERE.
Note that gmail seems to filter out messages sometimes. Therefore
make sure using non-gmail accounts.
-->
<to>${logback.errorEmail:-skibu@smith.net}</to>
<!-- Only send e-mail if special "EMAIL" marker is specified for an
ERROR level message.
-->
<evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>EMAIL</marker>
</evaluator>
<!-- Don't include messages that are DEBUG or TRACE if using cyclicBufferTracker
-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<!-- Provide last 5 entries (INFO, WARN, or ERROR) to provide context.
-->
<cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker">
<bufferSize>3</bufferSize>
</cyclicBufferTracker>
<!-- NOTE: it is important to set asynchronousSending to false. Otherwise
if trigger two SMTP messages within a short interval (within about 3
seconds) they overwrite each other causing the first message to be
delivered but to have the same content as the 2nd message. Also,
need async so that if program exits the message is first sent.
This means that if an error message sends out an e-mail the thread
will hang for the few seconds it takes to complete the sending of
the e-mail.
-->
<asynchronousSending>false</asynchronousSending>
<!-- Specifies details of how the message is sent and the format of it
-->
<smtpHost>smtp.gmail.com</smtpHost>
<smtpPort>465</smtpPort>
<SSL>true</SSL>
<username>transittestsmtp@gmail.com</username>
<password>transittest1</password>
<from>msmithtransit@gmail.com</from>
<subject>%level %logger{0} - %m</subject>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d{MMM dd yyyy - HH:mm:ss.SSS} - %-5level - %logger{35} :%n%message%n</pattern>
</layout>
</appender>
<!-- Separate file for config parameters logging -->
<appender name="CONFIG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE_ROOT}/configParams.log.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<charset>UTF-8</charset>
<pattern>${DATA_PATTERN}</pattern>
</encoder>
</appender>
<!-- Separate file for AVL logging -->
<appender name="AVL" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE_ROOT}/avl.log.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<charset>UTF-8</charset>
<pattern>${DEFAULT_PATTERN}</pattern>
</encoder>
</appender>
<!-- Separate file for ArrivalDeparture logging -->
<appender name="ARRIVAL_DEPARTURE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE_ROOT}/arrivalDeparture.log.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<charset>UTF-8</charset>
<pattern>${DATA_PATTERN}</pattern>
</encoder>
</appender>
<!-- Separate file for VehicleEvents logging -->
<appender name="VEHICLE_EVENT" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE_ROOT}/vehicleEvents.log.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<charset>UTF-8</charset>
<pattern>${DATA_PATTERN}</pattern>
</encoder>
</appender>
<!-- Separate file for Prediction logging -->
<appender name="PREDICTION" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE_ROOT}/prediction.log.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<charset>UTF-8</charset>
<pattern>${DATA_PATTERN}</pattern>
</encoder>
</appender>
<!-- Separate file for PRED_ACCURACY logging -->
<appender name="PRED_ACCURACY" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE_ROOT}/predAccuracy.log.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<charset>UTF-8</charset>
<pattern>${DEFAULT_PATTERN}</pattern>
</encoder>
</appender>
<!-- Separate file for Match logging -->
<appender name="MATCH" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE_ROOT}/match.log.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<charset>UTF-8</charset>
<pattern>${DATA_PATTERN}</pattern>
</encoder>
</appender>
<!-- In case easiest to write logs to console. -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<charset>UTF-8</charset>
<pattern>${DATA_PATTERN}</pattern>
</encoder>
</appender>
<!--======================================================-->
<!--=============== Loggers defined here =================-->
<!--======================================================-->
<!-- Specify various loggers. This where the logging
level is specified for each class. Note: cannot just have
two loggers defined for a name in order to define different
logging types depending on the level. Only the last definition is used
when duplicating the logging for a name. But can use filters as shown in
http://stackoverflow.com/questions/5653062/how-can-i-configure-logback-to-log-different-levels-for-a-logger-to-different-de
-->
<!-- For all the data logging files. Note: additivity must be set
to false so that data only logged to the data files instead
of also to the core logging file.
-->
<logger name="org.transitime.db.structs.ArrivalDeparture"
level="info" additivity="false">
<appender-ref ref="ARRIVAL_DEPARTURE" />
</logger>
<logger name="org.transitime.db.structs.VehicleEvent"
level="info" additivity="false">
<appender-ref ref="VEHICLE_EVENT" />
</logger>
<!-- Taken out (by setting level to warn) for now because so verbose -->
<logger name="org.transitime.ipc.data.IpcPrediction"
level="warn" additivity="false">
<appender-ref ref="PREDICTION" />
</logger>
<logger name="org.transitime.db.structs.Match"
level="info" additivity="false">
<appender-ref ref="MATCH" />
</logger>
<logger name="org.transitime.avl"
level="info" additivity="false">
<appender-ref ref="AVL" />
</logger>
<logger name="org.transitime.config"
level="info" additivity="false">
<appender-ref ref="CONFIG" />
</logger>
<logger name="org.transitime.core.predAccuracy"
level="debug" additivity="true">
<appender-ref ref="PRED_ACCURACY" />
</logger>
<!-- In order to log the hibernate SQL queries need to set org.hibernate.SQL
to debug. To show the values of the parameters need to set
org.hibernate.type to trace. Probably also want to set in
hibernate.cfg.xml the properties format_sql and use_sql_comments
to true so that the output of the SQL looks nice and includes the
SQL comments.
NOTE: Turning on this logging can greaty slow things down.
When inserting 10000 rows of AVLReports the time increated
from about 2.5 seconds to 10 seconds when the sql logging
was enabled. So don't use all the time!
-->
<!--
<logger name="org.hibernate.SQL" level="debug" additivity="false">
<appender-ref ref="CORE_DEBUG" />
</logger>
-->
<!-- For logging the parameter values for the SQL -->
<!--
<logger name="org.hibernate.type.descriptor.sql.BasicBinder"
level="trace" additivity="false">
<appender-ref ref="SQL" />
</logger>
-->
<!-- for debugging lazy loading -->
<!--
<logger name="org.transitime.db.structs"
level="debug" additivity="true">
<appender-ref ref="CORE_DEBUG" />
</logger>
-->
<!-- Miscellaneous debugging. Need to set additivity to true
so that will still get info and error level messages even
though CORE and CORE_DEBUG have filters to only show
proper info.
-->
<!--
<logger name="org.transitime.gtfs.DbConfig"
level="debug" additivity="true">
<appender-ref ref="CORE_DEBUG" />
</logger>
-->
<!--
<logger name="org.transitime.core.AvlProcessor"
level="debug" additivity="true">
<appender-ref ref="CORE_DEBUG" />
</logger>
-->
<!--
<logger name="org.transitime.core.MatchProcessor"
level="debug" additivity="true">
<appender-ref ref="CORE_DEBUG" />
</logger>
-->
<!--
<logger name="org.transitime.core.TemporalMatcher"
level="debug" additivity="true">
<appender-ref ref="CORE_DEBUG" />
</logger>
-->
<!--
<logger name="org.transitime.core.ArrivalDepartureGeneratorDefaultImpl"
level="debug" additivity="true">
<appender-ref ref="CORE_DEBUG" />
</logger>
-->
<!-- Set default level of root logger to "info" instead of to the
the default of "debug". This way the default is to only see important
messages. Debug messages have to be enabled by creating a logger
for the class. Was originally hoping to log errors to stdout but
this interfered with other loggers. If another logger level was set
to debug then for that class the message would also be logged via root
even though the logging level for route is configured to be info,
which is a higher level.
-->
<root level="info">
<appender-ref ref="CORE" />
<appender-ref ref="ERROR_SMTP" />
</root>
</configuration>