aboutsummaryrefslogtreecommitdiffstats
path: root/src/site-docs/adoc/fragments/howto-logging/example-logic.adoc
blob: 788894572ecff25cccd324ab6214a6f6bf3ea4b0 (plain)
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
//
// ============LICENSE_START=======================================================
//  Copyright (C) 2016-2018 Ericsson. All rights reserved.
// ================================================================================
// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
// 
// SPDX-License-Identifier: CC-BY-4.0
// ============LICENSE_END=========================================================
//
// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
//

== Example Configuration for Logging Logic

The following example shows a configuration that logs policy logic to standard out (__info__) and a file (__debug__)
All other APEX components are logging to a file (__debug__) and standard out (__error__).
This configuration an be used in a pre-production phase with the APEX engine still running in a separate terminal to monitor policy execution.
This logback configuration is in the APEX installation as `etc/logback-logic.xml`

[source%nowrap,xml]
----
<configuration debug="false">
  <statusListener class="ch.qos.logback.core.status.NopStatusListener" />

  <contextName>Apex</contextName>
  <property name="VAR_LOG" value="/var/log/ericsson/apex/" />

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
    </encoder>
  </appender>

  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
    <file>${VAR_LOG}/apex.log</file>
    <encoder>
      <pattern>
        %d %-5relative [procId=${processId}] [%thread] %-5level%logger{26} - %msg %n %ex{full}
      </pattern>
    </encoder>
  </appender>

  <appender name="POLICY_APPENDER_STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>policy: %msg\n</pattern>
    </encoder>
  </appender>

  <root level="error">
    <appender-ref ref="STDOUT" />
  </root>

<logger name="org.onap.policy.apex" level="debug" additivity="false">
  <appender-ref ref="FILE" />
</logger>

  <logger name="org.onap.policy.apex.executionlogging" level="debug" additivity="false">
    <appender-ref ref="POLICY_APPENDER_STDOUT" />
    <appender-ref ref="FILE" />
  </logger>
</configuration>
----