diff options
Diffstat (limited to 'a1-policy-management/src/main/resources')
3 files changed, 155 insertions, 10 deletions
diff --git a/a1-policy-management/src/main/resources/logback-json.xml b/a1-policy-management/src/main/resources/logback-json.xml new file mode 100644 index 00000000..3c22aeac --- /dev/null +++ b/a1-policy-management/src/main/resources/logback-json.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2025 OpenInfra Foundation Europe + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= + --> +<configuration> + <appender name="json" class="ch.qos.logback.core.ConsoleAppender"> + <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder"> + <providers> + <version> + <fieldName>version</fieldName> + <version>1.2.0</version> + </version> + <timestamp> + <fieldName>timestamp</fieldName> + <pattern>yyyy-MM-dd'T'HH:mm:ss.SSSZ</pattern> + </timestamp> + <pattern> + <omitEmptyFields>true</omitEmptyFields> + <pattern> + { + "service_id": "${SERVICE_ID:-a1pms}", + "message": "%msg", + "facility": "%X{facility}", + "subject": "%X{subject}", + "extra_data": { + "logger": "%logger", + "thread_info": { + "thread_name": "%thread" + }, + "dst": { + "trace_id": "%mdc{traceId}" + }, + "exception": { + "stack_trace": "%xEx" + } + }, + "metadata": { + "application_id": "${APP_ID:-a1pms}" + } + } + </pattern> + </pattern> + </providers> + + </encoder> + </appender> + + <root level="${ROOT_LOG_LEVEL:-INFO}"> + <appender-ref ref="json"/> + </root> + + <logger name="/" level="${ROOT_LOG_LEVEL:-INFO}"/> +</configuration> + diff --git a/a1-policy-management/src/main/resources/logback-plain.xml b/a1-policy-management/src/main/resources/logback-plain.xml index 0340cce8..014a983a 100644 --- a/a1-policy-management/src/main/resources/logback-plain.xml +++ b/a1-policy-management/src/main/resources/logback-plain.xml @@ -19,22 +19,17 @@ ~ --> <configuration> - - <!-- Define a plain text console appender --> <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <encoder> - <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{55} - <!-- - -->%replace(%X{facility}){'^(.+)$','facility=$1 | '} <!-- - -->%replace(%X{subject}){'^(.+)$','subject=$1 | ' } <!-- - -->%msg%n</pattern> + <pattern> + %d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [%thread] %-5level %logger - %msg [facility=%X{facility}, subject=%X{subject}, traceId=%mdc{traceId}] %n%xEx + </pattern> </encoder> </appender> - - - <!-- Configure root logger to use the plain text console appender for all log levels --> - <root level="INFO"> + <root level="${ROOT_LOG_LEVEL:-INFO}"> <appender-ref ref="console"/> </root> + <logger name="/" level="${ROOT_LOG_LEVEL:-INFO}"/> </configuration>
\ No newline at end of file diff --git a/a1-policy-management/src/main/resources/logback-stream.xml b/a1-policy-management/src/main/resources/logback-stream.xml new file mode 100644 index 00000000..9cfb863b --- /dev/null +++ b/a1-policy-management/src/main/resources/logback-stream.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2025 OpenInfra Foundation Europe + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= + --> +<configuration> + <appender name="json" class="net.logstash.logback.appender.LogstashTcpSocketAppender"> + <destination>localhost:5044</destination> + <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder"> + <providers> + <version> + <fieldName>version</fieldName> + <version>1.2.0</version> + </version> + <timestamp> + <fieldName>timestamp</fieldName> + <pattern>yyyy-MM-dd'T'HH:mm:ss.SSSZ</pattern> + </timestamp> + <pattern> + <omitEmptyFields>true</omitEmptyFields> + <pattern> + { + "service_id": "${SERVICE_ID:-a1pms}", + "message": "%msg", + "facility": "%X{facility}", + "subject": "%X{subject}", + "extra_data": { + "logger": "%logger", + "thread_info": { + "thread_name": "%thread" + }, + "dst": { + "trace_id": "%mdc{traceId}" + }, + "exception": { + "stack_trace": "%xEx" + } + }, + "metadata": { + "application_id": "${APP_ID:-a1pms}" + } + } + </pattern> + </pattern> + </providers> + + </encoder> + </appender> + + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern> + %d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [%thread] %-5level %logger - %msg [facility=%X{facility}, subject=%X{subject}, traceId=%mdc{traceId}] %n%xEx + </pattern> + </encoder> + </appender> + + <root level="${ROOT_LOG_LEVEL:-INFO}"> + <appender-ref ref="json"/> + <appender-ref ref="console"/> + </root> + + <logger name="/" level="${ROOT_LOG_LEVEL:-INFO}"/> +</configuration> + |