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 | == Example Configuration for Logging Logic |
| 15 | |
| 16 | The following example shows a configuration that logs policy logic to standard out (__info__) and a file (__debug__) |
| 17 | All other APEX components are logging to a file (__debug__) and standard out (__error__). |
| 18 | This configuration an be used in a pre-production phase with the APEX engine still running in a separate terminal to monitor policy execution. |
| 19 | This logback configuration is in the APEX installation as `etc/logback-logic.xml` |
| 20 | |
| 21 | [source%nowrap,xml] |
| 22 | ---- |
| 23 | <configuration debug="false"> |
| 24 | <statusListener class="ch.qos.logback.core.status.NopStatusListener" /> |
| 25 | |
| 26 | <contextName>Apex</contextName> |
| 27 | <property name="VAR_LOG" value="/var/log/ericsson/apex/" /> |
| 28 | |
| 29 | <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
| 30 | <encoder> |
| 31 | <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern> |
| 32 | </encoder> |
| 33 | </appender> |
| 34 | |
| 35 | <appender name="FILE" class="ch.qos.logback.core.FileAppender"> |
| 36 | <file>${VAR_LOG}/apex.log</file> |
| 37 | <encoder> |
| 38 | <pattern> |
| 39 | %d %-5relative [procId=${processId}] [%thread] %-5level%logger{26} - %msg %n %ex{full} |
| 40 | </pattern> |
| 41 | </encoder> |
| 42 | </appender> |
| 43 | |
| 44 | <appender name="POLICY_APPENDER_STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
| 45 | <encoder> |
| 46 | <pattern>policy: %msg\n</pattern> |
| 47 | </encoder> |
| 48 | </appender> |
| 49 | |
| 50 | <root level="error"> |
| 51 | <appender-ref ref="STDOUT" /> |
| 52 | </root> |
| 53 | |
| 54 | <logger name="org.onap.policy.apex" level="debug" additivity="false"> |
| 55 | <appender-ref ref="FILE" /> |
| 56 | </logger> |
| 57 | |
| 58 | <logger name="org.onap.policy.apex.executionlogging" level="debug" additivity="false"> |
| 59 | <appender-ref ref="POLICY_APPENDER_STDOUT" /> |
| 60 | <appender-ref ref="FILE" /> |
| 61 | </logger> |
| 62 | </configuration> |
| 63 | ---- |
| 64 | |