ramverma | af74a62 | 2018-07-31 18:25:39 +0100 | [diff] [blame] | 1 | // |
| 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 | |
| 16 | The standard logging configuration defines a context __APEX__, which is used in the standard output pattern. |
liamfallon | a41c877 | 2018-09-05 15:46:31 +0100 | [diff] [blame^] | 17 | The location for log files is defined in the property `VAR_LOG` and set to `/var/log/onap/policy/apex-pdp`. |
ramverma | af74a62 | 2018-07-31 18:25:39 +0100 | [diff] [blame] | 18 | The 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> |
liamfallon | a41c877 | 2018-09-05 15:46:31 +0100 | [diff] [blame^] | 26 | <property name="VAR_LOG" value="/var/log/onap/policy/apex-pdp/" /> |
ramverma | af74a62 | 2018-07-31 18:25:39 +0100 | [diff] [blame] | 27 | |
| 28 | ...appenders |
| 29 | ...loggers |
| 30 | </configuration> |
| 31 | ---- |
| 32 | |
| 33 | The 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 | |
| 44 | The 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 | |
liamfallon | a41c877 | 2018-09-05 15:46:31 +0100 | [diff] [blame^] | 52 | The second appender is called `FILE`. |
ramverma | af74a62 | 2018-07-31 18:25:39 +0100 | [diff] [blame] | 53 | It 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> |
liamfallon | a41c877 | 2018-09-05 15:46:31 +0100 | [diff] [blame^] | 59 | <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %n %ex{full}</pattern> |
ramverma | af74a62 | 2018-07-31 18:25:39 +0100 | [diff] [blame] | 60 | </encoder> |
| 61 | </appender> |
| 62 | ---- |
| 63 | |
liamfallon | a41c877 | 2018-09-05 15:46:31 +0100 | [diff] [blame^] | 64 | The third appender is called `CTXT_FILE`. |
ramverma | af74a62 | 2018-07-31 18:25:39 +0100 | [diff] [blame] | 65 | It writes logs to a file `apex_ctxt.log`. |
| 66 | [source%nowrap,xml,numbered] |
| 67 | ---- |
| 68 | <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender"> |
| 69 | <file>${VAR_LOG}/apex_ctxt.log</file> |
| 70 | <encoder> |
liamfallon | a41c877 | 2018-09-05 15:46:31 +0100 | [diff] [blame^] | 71 | <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level %logger{26} - %msg %n %ex{full}</pattern> |
ramverma | af74a62 | 2018-07-31 18:25:39 +0100 | [diff] [blame] | 72 | </encoder> |
| 73 | </appender> |
| 74 | ---- |
| 75 | |
| 76 | The last definitions are for specific loggers. |
liamfallon | a41c877 | 2018-09-05 15:46:31 +0100 | [diff] [blame^] | 77 | The first logger captures all standard APEX classes. |
| 78 | It is configured for log level __info__ and uses the standard output and file appenders. |
| 79 | The second logger captures APEX context classes responsible for context monitoring. |
| 80 | It is configured for log level __trace__ and uses the context file appender. |
ramverma | af74a62 | 2018-07-31 18:25:39 +0100 | [diff] [blame] | 81 | |
| 82 | [source%nowrap,xml,numbered] |
| 83 | ---- |
| 84 | <logger name="org.onap.policy.apex" level="info" additivity="false"> |
| 85 | <appender-ref ref="STDOUT" /> |
| 86 | <appender-ref ref="FILE" /> |
| 87 | </logger> |
| 88 | |
| 89 | <logger name="org.onap.policy.apex.core.context.monitoring" level="TRACE" additivity="false"> |
| 90 | <appender-ref ref="CTXT_FILE" /> |
| 91 | </logger> |
| 92 | ---- |
| 93 | |