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. |
| 17 | The location for log files is defined in the property `VAR_LOG` and set to `/var/log/apex`. |
| 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> |
| 26 | <property name="VAR_LOG" value="/var/log/ericsson/apex/" /> |
| 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 | |
| 52 | The first appender is called `FILE`. |
| 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> |
| 59 | <pattern> |
| 60 | %d %-5relative [procId=${processId}] [%thread] %-5level%logger{26} - %msg %n %ex{full} |
| 61 | </pattern> |
| 62 | </encoder> |
| 63 | </appender> |
| 64 | ---- |
| 65 | |
| 66 | The first appender is called `CTXT_FILE`. |
| 67 | It 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 | |
| 80 | The last definitions are for specific loggers. |
| 81 | The first logger captures all standard APEX classes, appends logs to `STDOUT` with the log level __info__. |
| 82 | The second logger capture all standard APEX classes, appends logs to `FILE` with log level __info__. |
| 83 | The 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 | |