blob: a09b3d27e42673981bdd0e27c1edf24db9ae1a4a [file] [log] [blame]
ramvermaaf74a622018-07-31 18:25:39 +01001//
2// ============LICENSE_START=======================================================
3// Copyright (C) 2016-2018 Ericsson. All rights reserved.
4// ================================================================================
5// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
6// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
7//
8// SPDX-License-Identifier: CC-BY-4.0
9// ============LICENSE_END=========================================================
10//
11// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
12//
13
14== Standard Logging Configuration
15
16The standard logging configuration defines a context __APEX__, which is used in the standard output pattern.
17The location for log files is defined in the property `VAR_LOG` and set to `/var/log/apex`.
18The standard status listener is set to __NOP__ and the overall logback configuration is set to no debug.
19
20[source%nowrap,xml,numbered]
21----
22<configuration debug="false">
23 <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
24
25 <contextName>Apex</contextName>
26 <property name="VAR_LOG" value="/var/log/ericsson/apex/" />
27
28 ...appenders
29 ...loggers
30</configuration>
31----
32
33The first appender defined is called `STDOUT` for logs to standard out.
34
35[source%nowrap,xml,numbered]
36----
37<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
38 <encoder>
39 <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
40 </encoder>
41</appender>
42----
43
44The root level logger then is set to the level __info__ using the standard out appender.
45[source%nowrap,xml,numbered]
46----
47<root level="info">
48 <appender-ref ref="STDOUT" />
49</root>
50----
51
52The first appender is called `FILE`.
53It writes logs to a file `apex.log`.
54[source%nowrap,xml,numbered]
55----
56<appender name="FILE" class="ch.qos.logback.core.FileAppender">
57 <file>${VAR_LOG}/apex.log</file>
58 <encoder>
59 <pattern>
60 %d %-5relative [procId=${processId}] [%thread] %-5level%logger{26} - %msg %n %ex{full}
61 </pattern>
62 </encoder>
63</appender>
64----
65
66The first appender is called `CTXT_FILE`.
67It writes logs to a file `apex_ctxt.log`.
68[source%nowrap,xml,numbered]
69----
70<appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender">
71 <file>${VAR_LOG}/apex_ctxt.log</file>
72 <encoder>
73 <pattern>
74 %d %-5relative [procId=${processId}] [%thread] %-5level%logger{26} - %msg %n %ex{full}
75 </pattern>
76 </encoder>
77</appender>
78----
79
80The last definitions are for specific loggers.
81The first logger captures all standard APEX classes, appends logs to `STDOUT` with the log level __info__.
82The second logger capture all standard APEX classes, appends logs to `FILE` with log level __info__.
83The third logger captures context monitoring classes, appends logs to `CTXT_FILE` with log level __trace__.
84
85[source%nowrap,xml,numbered]
86----
87<logger name="org.onap.policy.apex" level="info" additivity="false">
88 <appender-ref ref="STDOUT" />
89 <appender-ref ref="FILE" />
90</logger>
91
92<logger name="org.onap.policy.apex.core.context.monitoring" level="TRACE" additivity="false">
93 <appender-ref ref="CTXT_FILE" />
94</logger>
95----
96