From 48ac86f9b2a6a0fb62c35d6d7ece9a9131d3d12e Mon Sep 17 00:00:00 2001 From: Madhan Neethiraj <madhan@apache.org> Date: Mon, 11 Nov 2024 16:22:39 -0800 Subject: [PATCH 01/23] ATLAS-4917: replace use of log4j with logback --- .../src/test/resources/logback.xml | 38 ++-- addons/falcon-bridge/pom.xml | 4 +- .../src/test/resources/atlas-log4j.xml | 137 ------------- .../src/test/resources/atlas-logback.xml | 132 +++++++++++++ addons/hbase-bridge/pom.xml | 9 +- .../resources/atlas-hbase-import-log4j.xml | 55 ------ .../resources/atlas-hbase-import-logback.xml | 56 ++++++ .../src/test/resources/atlas-log4j.xml | 143 -------------- .../src/test/resources/atlas-logback.xml | 149 ++++++++++++++ .../src/test/resources/atlas-log4j.xml | 130 ------------- .../src/test/resources/atlas-logback.xml | 131 +++++++++++++ addons/hive-bridge/pom.xml | 13 +- .../resources/atlas-hive-import-log4j.xml | 57 ------ .../resources/atlas-hive-import-logback.xml | 56 ++++++ .../src/test/resources/atlas-log4j.xml | 137 ------------- .../src/test/resources/atlas-logback.xml | 132 +++++++++++++ addons/impala-bridge/pom.xml | 17 +- .../{atlas-log4j.xml => atlas-logback.xml} | 31 ++- .../src/test/resources/atlas-log4j.xml | 130 ------------- .../src/test/resources/atlas-logback.xml | 132 +++++++++++++ addons/kafka-bridge/pom.xml | 4 +- .../resources/atlas-kafka-import-log4j.xml | 55 ------ .../resources/atlas-kafka-import-logback.xml | 56 ++++++ .../src/test/resources/atlas-log4j.xml | 137 ------------- .../src/test/resources/atlas-logback.xml | 132 +++++++++++++ addons/sqoop-bridge/pom.xml | 4 +- .../src/test/resources/atlas-log4j.xml | 137 ------------- .../src/test/resources/atlas-logback.xml | 132 +++++++++++++ addons/storm-bridge/pom.xml | 19 +- .../src/test/resources/atlas-log4j.xml | 137 ------------- .../src/test/resources/atlas-logback.xml | 132 +++++++++++++ atlas-hub/atlas-logback.xml | 47 +++++ atlas-hub/pre-conf/atlas-log4j.xml | 156 --------------- atlas-hub/pre-conf/zookeeper/log4j.properties | 75 -------- common/src/test/resources/atlas-log4j.xml | 76 -------- common/src/test/resources/atlas-logback.xml | 54 ++++++ common/src/test/resources/log4j.properties | 34 ---- .../src/test/resources/logback.xml | 41 ++-- distro/src/bin/atlas_client_cmdline.py | 2 +- distro/src/bin/atlas_start.py | 2 +- distro/src/conf/atlas-log4j.xml | 167 ---------------- distro/src/conf/atlas-logback.xml | 177 +++++++++++++++++ distro/src/conf/zookeeper/log4j.properties | 75 -------- distro/src/conf/zookeeper/logback.xml | 56 ++++++ .../main/assemblies/atlas-server-package.xml | 4 +- .../assemblies/classification-updater.xml | 2 +- .../main/assemblies/migration-exporter.xml | 2 +- .../main/assemblies/notification-analyzer.xml | 71 +++++++ .../main/assemblies/standalone-package.xml | 2 +- .../src/test/python/scripts/TestMetadata.py | 12 +- intg/src/main/resources/atlas-log4j.xml | 105 ---------- intg/src/main/resources/atlas-logback.xml | 101 ++++++++++ notification/pom.xml | 24 +-- .../java/org/apache/atlas/hook/AtlasHook.java | 10 +- .../atlas/hook/FailedMessagesLogger.java | 39 +--- .../atlas/notification/LogConfigUtils.java | 159 --------------- pom.xml | 123 ++++++++---- test-tools/pom.xml | 22 ++- test-tools/src/main/resources/logback.xml | 56 ++++++ .../src/main/resources/atlas-logback.xml | 41 ++++ .../src/main/resources/repair_index.py | 2 +- .../atlas-migration-exporter/atlas-log4j.xml | 73 ------- .../atlas-logback.xml | 72 +++++++ .../atlas_migration_export.py | 2 +- .../src/main/resources/atlas-logback.xml | 41 ++++ tools/notification-analyzer/pom.xml | 182 ++++++++++++++++++ webapp/pom.xml | 27 ++- 67 files changed, 2380 insertions(+), 2388 deletions(-) rename tools/classification-updater/src/main/resources/atlas-log4j.xml => addons/couchbase-bridge/src/test/resources/logback.xml (50%) delete mode 100755 addons/falcon-bridge/src/test/resources/atlas-log4j.xml create mode 100755 addons/falcon-bridge/src/test/resources/atlas-logback.xml delete mode 100644 addons/hbase-bridge/src/main/resources/atlas-hbase-import-log4j.xml create mode 100644 addons/hbase-bridge/src/main/resources/atlas-hbase-import-logback.xml delete mode 100755 addons/hbase-bridge/src/test/resources/atlas-log4j.xml create mode 100755 addons/hbase-bridge/src/test/resources/atlas-logback.xml delete mode 100755 addons/hbase-testing-util/src/test/resources/atlas-log4j.xml create mode 100755 addons/hbase-testing-util/src/test/resources/atlas-logback.xml delete mode 100644 addons/hive-bridge/src/main/resources/atlas-hive-import-log4j.xml create mode 100644 addons/hive-bridge/src/main/resources/atlas-hive-import-logback.xml delete mode 100755 addons/hive-bridge/src/test/resources/atlas-log4j.xml create mode 100755 addons/hive-bridge/src/test/resources/atlas-logback.xml rename addons/impala-bridge/src/main/resources/{atlas-log4j.xml => atlas-logback.xml} (61%) delete mode 100644 addons/impala-bridge/src/test/resources/atlas-log4j.xml create mode 100644 addons/impala-bridge/src/test/resources/atlas-logback.xml delete mode 100644 addons/kafka-bridge/src/main/resources/atlas-kafka-import-log4j.xml create mode 100644 addons/kafka-bridge/src/main/resources/atlas-kafka-import-logback.xml delete mode 100755 addons/kafka-bridge/src/test/resources/atlas-log4j.xml create mode 100755 addons/kafka-bridge/src/test/resources/atlas-logback.xml delete mode 100755 addons/sqoop-bridge/src/test/resources/atlas-log4j.xml create mode 100755 addons/sqoop-bridge/src/test/resources/atlas-logback.xml delete mode 100755 addons/storm-bridge/src/test/resources/atlas-log4j.xml create mode 100755 addons/storm-bridge/src/test/resources/atlas-logback.xml create mode 100755 atlas-hub/atlas-logback.xml delete mode 100644 atlas-hub/pre-conf/atlas-log4j.xml delete mode 100644 atlas-hub/pre-conf/zookeeper/log4j.properties delete mode 100644 common/src/test/resources/atlas-log4j.xml create mode 100644 common/src/test/resources/atlas-logback.xml delete mode 100644 common/src/test/resources/log4j.properties rename tools/atlas-index-repair/src/main/resources/atlas-log4j.xml => common/src/test/resources/logback.xml (50%) delete mode 100755 distro/src/conf/atlas-log4j.xml create mode 100755 distro/src/conf/atlas-logback.xml delete mode 100755 distro/src/conf/zookeeper/log4j.properties create mode 100644 distro/src/conf/zookeeper/logback.xml create mode 100644 distro/src/main/assemblies/notification-analyzer.xml delete mode 100755 intg/src/main/resources/atlas-log4j.xml create mode 100755 intg/src/main/resources/atlas-logback.xml create mode 100644 test-tools/src/main/resources/logback.xml create mode 100644 tools/atlas-index-repair/src/main/resources/atlas-logback.xml delete mode 100755 tools/atlas-migration-exporter/atlas-log4j.xml create mode 100755 tools/atlas-migration-exporter/atlas-logback.xml create mode 100644 tools/classification-updater/src/main/resources/atlas-logback.xml create mode 100644 tools/notification-analyzer/pom.xml diff --git a/tools/classification-updater/src/main/resources/atlas-log4j.xml b/addons/couchbase-bridge/src/test/resources/logback.xml similarity index 50% rename from tools/classification-updater/src/main/resources/atlas-log4j.xml rename to addons/couchbase-bridge/src/test/resources/logback.xml index 9658edf4ec..b27fd82b90 100644 --- a/tools/classification-updater/src/main/resources/atlas-log4j.xml +++ b/addons/couchbase-bridge/src/test/resources/logback.xml @@ -17,26 +17,22 @@ ~ limitations under the License. --> -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="/var/log/atlas/classification-updater.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="console"/> + </logger> - <logger name="org.apache.atlas.tools.BulkFetchAndUpdate" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> -</log4j:configuration> + <root level="DEBUG"> + <appender-ref ref="console"/> + </root> +</configuration> diff --git a/addons/falcon-bridge/pom.xml b/addons/falcon-bridge/pom.xml index 1e2ce7c81b..0c9e66bf45 100644 --- a/addons/falcon-bridge/pom.xml +++ b/addons/falcon-bridge/pom.xml @@ -267,8 +267,8 @@ <value>application.log</value> </systemProperty> <systemProperty> - <name>log4j.configuration</name> - <value>file:///${project.build.directory}/test-classes/atlas-log4j.xml</value> + <name>logback.configurationFile</name> + <value>file:///${project.build.directory}/test-classes/atlas-logback.xml</value> </systemProperty> <systemProperty> <name>atlas.graphdb.backend</name> diff --git a/addons/falcon-bridge/src/test/resources/atlas-log4j.xml b/addons/falcon-bridge/src/test/resources/atlas-log4j.xml deleted file mode 100755 index 262a710f7a..0000000000 --- a/addons/falcon-bridge/src/test/resources/atlas-log4j.xml +++ /dev/null @@ -1,137 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="AUDIT" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/audit.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="METRICS" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/metric.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="FAILED" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/failed.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %m"/> - </layout> - </appender> - - <!-- Uncomment the following for perf logs --> - <!-- - <appender name="perf_appender" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="file" value="${atlas.log.dir}/atlas_perf.log" /> - <param name="datePattern" value="'.'yyyy-MM-dd" /> - <param name="append" value="true" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d|%t|%m%n" /> - </layout> - </appender> - - <logger name="org.apache.atlas.perf" additivity="false"> - <level value="debug" /> - <appender-ref ref="perf_appender" /> - </logger> - --> - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.janusgraph" additivity="false"> - <level value="warn"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.springframework" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.eclipse" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="com.sun.jersey" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="AUDIT" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <logger name="METRICS" additivity="false"> - <level value="debug"/> - <appender-ref ref="METRICS"/> - </logger> - - <logger name="FAILED" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> diff --git a/addons/falcon-bridge/src/test/resources/atlas-logback.xml b/addons/falcon-bridge/src/test/resources/atlas-logback.xml new file mode 100755 index 0000000000..78fd420dc8 --- /dev/null +++ b/addons/falcon-bridge/src/test/resources/atlas-logback.xml @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/audit.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/audit-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/metrics.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/metrics-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="FAILED" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/failed.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/failed-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.ImpalaLineageTool" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.hook.ImpalaLineageHook" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.janusgraph" additivity="false" level="warn"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.springframework" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.eclipse" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="com.sun.jersey" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="METRICS" additivity="false" level="debug"> + <appender-ref ref="METRICS"/> + </logger> + + <logger name="FAILED" additivity="false" level="info"> + <appender-ref ref="FAILED"/> + </logger> + + <logger name="AUDIT" additivity="false" level="info"> + <appender-ref ref="AUDIT"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/addons/hbase-bridge/pom.xml b/addons/hbase-bridge/pom.xml index fe5a711816..f46b9a73fc 100644 --- a/addons/hbase-bridge/pom.xml +++ b/addons/hbase-bridge/pom.xml @@ -339,6 +339,11 @@ <artifactId>jsr311-api</artifactId> <version>${jsr.version}</version> </artifactItem> + <artifactItem> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logback.version}</version> + </artifactItem> </artifactItems> </configuration> </execution> @@ -417,8 +422,8 @@ <value>application.log</value> </systemProperty> <systemProperty> - <name>log4j.configuration</name> - <value>file:///${project.build.directory}/test-classes/atlas-log4j.xml</value> + <name>logback.configurationFile</name> + <value>file:///${project.build.directory}/test-classes/atlas-logback.xml</value> </systemProperty> <systemProperty> <name>atlas.graphdb.backend</name> diff --git a/addons/hbase-bridge/src/main/resources/atlas-hbase-import-log4j.xml b/addons/hbase-bridge/src/main/resources/atlas-hbase-import-log4j.xml deleted file mode 100644 index 3fc2dcf9c3..0000000000 --- a/addons/hbase-bridge/src/main/resources/atlas-hbase-import-log4j.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <root> - <priority value="info"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> diff --git a/addons/hbase-bridge/src/main/resources/atlas-hbase-import-logback.xml b/addons/hbase-bridge/src/main/resources/atlas-hbase-import-logback.xml new file mode 100644 index 0000000000..af9652f84e --- /dev/null +++ b/addons/hbase-bridge/src/main/resources/atlas-hbase-import-logback.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="FILE"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/addons/hbase-bridge/src/test/resources/atlas-log4j.xml b/addons/hbase-bridge/src/test/resources/atlas-log4j.xml deleted file mode 100755 index 2c9815ff54..0000000000 --- a/addons/hbase-bridge/src/test/resources/atlas-log4j.xml +++ /dev/null @@ -1,143 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="AUDIT" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/audit.log"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="METRICS" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/metric.log"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="HBASE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/hbase.log"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="FAILED" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/failed.log"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %m"/> - </layout> - </appender> - - <!-- Uncomment the following for perf logs --> - <!-- - <appender name="perf_appender" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="file" value="${atlas.log.dir}/atlas_perf.log" /> - <param name="datePattern" value="'.'yyyy-MM-dd" /> - <param name="append" value="true" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d|%t|%m%n" /> - </layout> - </appender> - - <logger name="org.apache.atlas.perf" additivity="false"> - <level value="debug" /> - <appender-ref ref="perf_appender" /> - </logger> - --> - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.apache.hadoop" additivity="false"> - <level value="debug"/> - <appender-ref ref="HBASE"/> - </logger> - - <logger name="org.janusgraph" additivity="false"> - <level value="warn"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.springframework" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.eclipse" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="com.sun.jersey" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="AUDIT" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <logger name="METRICS" additivity="false"> - <level value="debug"/> - <appender-ref ref="METRICS"/> - </logger> - - <logger name="FAILED" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> diff --git a/addons/hbase-bridge/src/test/resources/atlas-logback.xml b/addons/hbase-bridge/src/test/resources/atlas-logback.xml new file mode 100755 index 0000000000..5e96004c92 --- /dev/null +++ b/addons/hbase-bridge/src/test/resources/atlas-logback.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/audit.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/audit-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/metrics.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/metrics-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="HBASE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/hbase.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/hbase-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="FAILED" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/failed.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/failed-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.hadoop" additivity="false" level="debug"> + <appender-ref ref="HBASE"/> + </logger> + + <logger name="org.apache.atlas.impala.ImpalaLineageTool" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.hook.ImpalaLineageHook" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.janusgraph" additivity="false" level="warn"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.springframework" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.eclipse" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="com.sun.jersey" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="METRICS" additivity="false" level="debug"> + <appender-ref ref="METRICS"/> + </logger> + + <logger name="FAILED" additivity="false" level="info"> + <appender-ref ref="FAILED"/> + </logger> + + <logger name="AUDIT" additivity="false" level="info"> + <appender-ref ref="AUDIT"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/addons/hbase-testing-util/src/test/resources/atlas-log4j.xml b/addons/hbase-testing-util/src/test/resources/atlas-log4j.xml deleted file mode 100755 index 47d4d5c7ce..0000000000 --- a/addons/hbase-testing-util/src/test/resources/atlas-log4j.xml +++ /dev/null @@ -1,130 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="AUDIT" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/audit.log"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="METRICS" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/metric.log"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="FAILED" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/failed.log"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %m"/> - </layout> - </appender> - - <!-- Uncomment the following for perf logs --> - <!-- - <appender name="perf_appender" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="file" value="${atlas.log.dir}/atlas_perf.log" /> - <param name="datePattern" value="'.'yyyy-MM-dd" /> - <param name="append" value="true" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d|%t|%m%n" /> - </layout> - </appender> - - <logger name="org.apache.atlas.perf" additivity="false"> - <level value="debug" /> - <appender-ref ref="perf_appender" /> - </logger> - --> - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.janusgraph" additivity="false"> - <level value="warn"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.springframework" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.eclipse" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="com.sun.jersey" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="AUDIT" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <logger name="METRICS" additivity="false"> - <level value="debug"/> - <appender-ref ref="METRICS"/> - </logger> - - <logger name="FAILED" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> diff --git a/addons/hbase-testing-util/src/test/resources/atlas-logback.xml b/addons/hbase-testing-util/src/test/resources/atlas-logback.xml new file mode 100755 index 0000000000..e5562bad13 --- /dev/null +++ b/addons/hbase-testing-util/src/test/resources/atlas-logback.xml @@ -0,0 +1,131 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/audit.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/audit-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/metrics.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/metrics-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="FAILED" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/failed.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/failed-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.ImpalaLineageTool" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.hook.ImpalaLineageHook" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.janusgraph" additivity="false" level="warn"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.springframework" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.eclipse" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="com.sun.jersey" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="METRICS" additivity="false" level="debug"> + <appender-ref ref="METRICS"/> + </logger> + + <logger name="FAILED" additivity="false" level="info"> + <appender-ref ref="FAILED"/> + </logger> + + <logger name="AUDIT" additivity="false" level="info"> + <appender-ref ref="AUDIT"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/addons/hive-bridge/pom.xml b/addons/hive-bridge/pom.xml index 8c3636e5d6..c8b192beb9 100755 --- a/addons/hive-bridge/pom.xml +++ b/addons/hive-bridge/pom.xml @@ -152,6 +152,10 @@ <groupId>org.eclipse.jetty</groupId> <artifactId>*</artifactId> </exclusion> + <exclusion> + <groupId>org.apache.commons</groupId> + <artifactId>commons-text</artifactId> + </exclusion> </exclusions> </dependency> @@ -312,6 +316,11 @@ <artifactId>jsr311-api</artifactId> <version>${jsr.version}</version> </artifactItem> + <artifactItem> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logback.version}</version> + </artifactItem> </artifactItems> </configuration> </execution> @@ -390,8 +399,8 @@ <value>application.log</value> </systemProperty> <systemProperty> - <name>log4j.configuration</name> - <value>file:///${project.build.directory}/test-classes/atlas-log4j.xml</value> + <name>logback.configurationFile</name> + <value>file:///${project.build.directory}/test-classes/atlas-logback.xml</value> </systemProperty> <systemProperty> <name>atlas.graphdb.backend</name> diff --git a/addons/hive-bridge/src/main/resources/atlas-hive-import-log4j.xml b/addons/hive-bridge/src/main/resources/atlas-hive-import-log4j.xml deleted file mode 100644 index 22a8cc9d43..0000000000 --- a/addons/hive-bridge/src/main/resources/atlas-hive-import-log4j.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - </layout> - </appender> - - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> diff --git a/addons/hive-bridge/src/main/resources/atlas-hive-import-logback.xml b/addons/hive-bridge/src/main/resources/atlas-hive-import-logback.xml new file mode 100644 index 0000000000..af9652f84e --- /dev/null +++ b/addons/hive-bridge/src/main/resources/atlas-hive-import-logback.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="FILE"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/addons/hive-bridge/src/test/resources/atlas-log4j.xml b/addons/hive-bridge/src/test/resources/atlas-log4j.xml deleted file mode 100755 index 262a710f7a..0000000000 --- a/addons/hive-bridge/src/test/resources/atlas-log4j.xml +++ /dev/null @@ -1,137 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="AUDIT" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/audit.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="METRICS" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/metric.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="FAILED" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/failed.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %m"/> - </layout> - </appender> - - <!-- Uncomment the following for perf logs --> - <!-- - <appender name="perf_appender" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="file" value="${atlas.log.dir}/atlas_perf.log" /> - <param name="datePattern" value="'.'yyyy-MM-dd" /> - <param name="append" value="true" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d|%t|%m%n" /> - </layout> - </appender> - - <logger name="org.apache.atlas.perf" additivity="false"> - <level value="debug" /> - <appender-ref ref="perf_appender" /> - </logger> - --> - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.janusgraph" additivity="false"> - <level value="warn"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.springframework" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.eclipse" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="com.sun.jersey" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="AUDIT" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <logger name="METRICS" additivity="false"> - <level value="debug"/> - <appender-ref ref="METRICS"/> - </logger> - - <logger name="FAILED" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> diff --git a/addons/hive-bridge/src/test/resources/atlas-logback.xml b/addons/hive-bridge/src/test/resources/atlas-logback.xml new file mode 100755 index 0000000000..0aa06e29ee --- /dev/null +++ b/addons/hive-bridge/src/test/resources/atlas-logback.xml @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>15</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/audit.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/audit-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/metrics.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/metrics-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="FAILED" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/failed.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/failed-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.ImpalaLineageTool" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.hook.ImpalaLineageHook" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.janusgraph" additivity="false" level="warn"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.springframework" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.eclipse" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="com.sun.jersey" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="METRICS" additivity="false" level="debug"> + <appender-ref ref="METRICS"/> + </logger> + + <logger name="FAILED" additivity="false" level="info"> + <appender-ref ref="FAILED"/> + </logger> + + <logger name="AUDIT" additivity="false" level="info"> + <appender-ref ref="AUDIT"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/addons/impala-bridge/pom.xml b/addons/impala-bridge/pom.xml index 186251abe2..01acc54152 100644 --- a/addons/impala-bridge/pom.xml +++ b/addons/impala-bridge/pom.xml @@ -59,16 +59,11 @@ <version>${project.version}</version> <scope>test</scope> </dependency> + <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>${log4j2.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - <version>${log4j2.version}</version> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logback.version}</version> <scope>test</scope> </dependency> @@ -404,8 +399,8 @@ <value>application.log</value> </systemProperty> <systemProperty> - <name>log4j.configuration</name> - <value>file:///${project.build.directory}/test-classes/atlas-log4j.xml</value> + <name>logback.configurationFile</name> + <value>file:///${project.build.directory}/test-classes/atlas-logback.xml</value> </systemProperty> <systemProperty> <name>atlas.graphdb.backend</name> diff --git a/addons/impala-bridge/src/main/resources/atlas-log4j.xml b/addons/impala-bridge/src/main/resources/atlas-logback.xml similarity index 61% rename from addons/impala-bridge/src/main/resources/atlas-log4j.xml rename to addons/impala-bridge/src/main/resources/atlas-logback.xml index 97317a8754..4148502c6d 100644 --- a/addons/impala-bridge/src/main/resources/atlas-log4j.xml +++ b/addons/impala-bridge/src/main/resources/atlas-logback.xml @@ -17,26 +17,25 @@ ~ limitations under the License. --> -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="/var/log/hive/impala-bridge.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> +<configuration> + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>/var/log/hive/impala-bridge.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>/var/log/hive/impala-bridge-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> </appender> - <logger name="org.apache.atlas.impala.ImpalaLineageTool" additivity="false"> - <level value="info"/> + <logger name="org.apache.atlas.impala.ImpalaLineageTool" additivity="false" level="info"> <appender-ref ref="FILE"/> </logger> - <root> - <priority value="warn"/> + <root level="warn"> <appender-ref ref="FILE"/> </root> -</log4j:configuration> \ No newline at end of file +</configuration> diff --git a/addons/impala-bridge/src/test/resources/atlas-log4j.xml b/addons/impala-bridge/src/test/resources/atlas-log4j.xml deleted file mode 100644 index c661d36f81..0000000000 --- a/addons/impala-bridge/src/test/resources/atlas-log4j.xml +++ /dev/null @@ -1,130 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="AUDIT" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/audit.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="METRICS" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/metric.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="FAILED" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/failed.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %m"/> - </layout> - </appender> - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.apache.atlas.impala.ImpalaLineageTool" additivity="false"> - <level value="debug"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.apache.atlas.impala.hook.ImpalaLineageHook" additivity="false"> - <level value="debug"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.janusgraph" additivity="false"> - <level value="warn"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.springframework" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.eclipse" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="com.sun.jersey" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="AUDIT" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <logger name="METRICS" additivity="false"> - <level value="debug"/> - <appender-ref ref="METRICS"/> - </logger> - - <logger name="FAILED" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> diff --git a/addons/impala-bridge/src/test/resources/atlas-logback.xml b/addons/impala-bridge/src/test/resources/atlas-logback.xml new file mode 100644 index 0000000000..78fd420dc8 --- /dev/null +++ b/addons/impala-bridge/src/test/resources/atlas-logback.xml @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/audit.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/audit-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/metrics.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/metrics-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="FAILED" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/failed.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/failed-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.ImpalaLineageTool" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.hook.ImpalaLineageHook" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.janusgraph" additivity="false" level="warn"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.springframework" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.eclipse" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="com.sun.jersey" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="METRICS" additivity="false" level="debug"> + <appender-ref ref="METRICS"/> + </logger> + + <logger name="FAILED" additivity="false" level="info"> + <appender-ref ref="FAILED"/> + </logger> + + <logger name="AUDIT" additivity="false" level="info"> + <appender-ref ref="AUDIT"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/addons/kafka-bridge/pom.xml b/addons/kafka-bridge/pom.xml index 820b478441..dc1d5de0e1 100644 --- a/addons/kafka-bridge/pom.xml +++ b/addons/kafka-bridge/pom.xml @@ -253,8 +253,8 @@ <value>application.log</value> </systemProperty> <systemProperty> - <name>log4j.configuration</name> - <value>file:///${project.build.directory}/test-classes/atlas-log4j.xml</value> + <name>logback.configurationFile</name> + <value>file:///${project.build.directory}/test-classes/atlas-logback.xml</value> </systemProperty> <systemProperty> <name>atlas.graphdb.backend</name> diff --git a/addons/kafka-bridge/src/main/resources/atlas-kafka-import-log4j.xml b/addons/kafka-bridge/src/main/resources/atlas-kafka-import-log4j.xml deleted file mode 100644 index 3fc2dcf9c3..0000000000 --- a/addons/kafka-bridge/src/main/resources/atlas-kafka-import-log4j.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <root> - <priority value="info"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> diff --git a/addons/kafka-bridge/src/main/resources/atlas-kafka-import-logback.xml b/addons/kafka-bridge/src/main/resources/atlas-kafka-import-logback.xml new file mode 100644 index 0000000000..80e705c131 --- /dev/null +++ b/addons/kafka-bridge/src/main/resources/atlas-kafka-import-logback.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>15</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="FILE"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/addons/kafka-bridge/src/test/resources/atlas-log4j.xml b/addons/kafka-bridge/src/test/resources/atlas-log4j.xml deleted file mode 100755 index 0b9b36e36b..0000000000 --- a/addons/kafka-bridge/src/test/resources/atlas-log4j.xml +++ /dev/null @@ -1,137 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="AUDIT" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/audit.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="METRICS" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/metric.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="FAILED" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/failed.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %m"/> - </layout> - </appender> - - <!-- Uncomment the following for perf logs --> - <!-- - <appender name="perf_appender" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="file" value="${atlas.log.dir}/atlas_perf.log" /> - <param name="datePattern" value="'.'yyyy-MM-dd" /> - <param name="append" value="true" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d|%t|%m%n" /> - </layout> - </appender> - - <logger name="org.apache.atlas.perf" additivity="false"> - <level value="debug" /> - <appender-ref ref="perf_appender" /> - </logger> - --> - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="com.thinkaurelius.titan" additivity="false"> - <level value="warn"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.springframework" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.eclipse" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="com.sun.jersey" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="AUDIT" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <logger name="METRICS" additivity="false"> - <level value="debug"/> - <appender-ref ref="METRICS"/> - </logger> - - <logger name="FAILED" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> diff --git a/addons/kafka-bridge/src/test/resources/atlas-logback.xml b/addons/kafka-bridge/src/test/resources/atlas-logback.xml new file mode 100755 index 0000000000..78fd420dc8 --- /dev/null +++ b/addons/kafka-bridge/src/test/resources/atlas-logback.xml @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/audit.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/audit-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/metrics.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/metrics-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="FAILED" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/failed.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/failed-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.ImpalaLineageTool" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.hook.ImpalaLineageHook" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.janusgraph" additivity="false" level="warn"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.springframework" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.eclipse" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="com.sun.jersey" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="METRICS" additivity="false" level="debug"> + <appender-ref ref="METRICS"/> + </logger> + + <logger name="FAILED" additivity="false" level="info"> + <appender-ref ref="FAILED"/> + </logger> + + <logger name="AUDIT" additivity="false" level="info"> + <appender-ref ref="AUDIT"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/addons/sqoop-bridge/pom.xml b/addons/sqoop-bridge/pom.xml index 021e93f56d..ffe3943822 100644 --- a/addons/sqoop-bridge/pom.xml +++ b/addons/sqoop-bridge/pom.xml @@ -327,8 +327,8 @@ <value>application.log</value> </systemProperty> <systemProperty> - <name>log4j.configuration</name> - <value>file:///${project.build.directory}/test-classes/atlas-log4j.xml</value> + <name>logback.configurationFile</name> + <value>file:///${project.build.directory}/test-classes/atlas-logback.xml</value> </systemProperty> <systemProperty> <name>atlas.graphdb.backend</name> diff --git a/addons/sqoop-bridge/src/test/resources/atlas-log4j.xml b/addons/sqoop-bridge/src/test/resources/atlas-log4j.xml deleted file mode 100755 index 262a710f7a..0000000000 --- a/addons/sqoop-bridge/src/test/resources/atlas-log4j.xml +++ /dev/null @@ -1,137 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="AUDIT" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/audit.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="METRICS" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/metric.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="FAILED" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/failed.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %m"/> - </layout> - </appender> - - <!-- Uncomment the following for perf logs --> - <!-- - <appender name="perf_appender" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="file" value="${atlas.log.dir}/atlas_perf.log" /> - <param name="datePattern" value="'.'yyyy-MM-dd" /> - <param name="append" value="true" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d|%t|%m%n" /> - </layout> - </appender> - - <logger name="org.apache.atlas.perf" additivity="false"> - <level value="debug" /> - <appender-ref ref="perf_appender" /> - </logger> - --> - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.janusgraph" additivity="false"> - <level value="warn"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.springframework" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.eclipse" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="com.sun.jersey" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="AUDIT" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <logger name="METRICS" additivity="false"> - <level value="debug"/> - <appender-ref ref="METRICS"/> - </logger> - - <logger name="FAILED" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> diff --git a/addons/sqoop-bridge/src/test/resources/atlas-logback.xml b/addons/sqoop-bridge/src/test/resources/atlas-logback.xml new file mode 100755 index 0000000000..78fd420dc8 --- /dev/null +++ b/addons/sqoop-bridge/src/test/resources/atlas-logback.xml @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/audit.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/audit-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/metrics.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/metrics-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="FAILED" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/failed.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/failed-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.ImpalaLineageTool" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.hook.ImpalaLineageHook" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.janusgraph" additivity="false" level="warn"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.springframework" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.eclipse" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="com.sun.jersey" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="METRICS" additivity="false" level="debug"> + <appender-ref ref="METRICS"/> + </logger> + + <logger name="FAILED" additivity="false" level="info"> + <appender-ref ref="FAILED"/> + </logger> + + <logger name="AUDIT" additivity="false" level="info"> + <appender-ref ref="AUDIT"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/addons/storm-bridge/pom.xml b/addons/storm-bridge/pom.xml index 77dce71536..2699a1322f 100644 --- a/addons/storm-bridge/pom.xml +++ b/addons/storm-bridge/pom.xml @@ -77,6 +77,10 @@ <groupId>org.eclipse.jetty</groupId> <artifactId>*</artifactId> </exclusion> + <exclusion> + <groupId>org.apache.commons</groupId> + <artifactId>commons-text</artifactId> + </exclusion> </exclusions> </dependency> @@ -92,6 +96,10 @@ <artifactId>storm-core</artifactId> <version>${storm.version}</version> <exclusions> + <exclusion> + <groupId>org.apache.storm</groupId> + <artifactId>storm-clojure</artifactId> + </exclusion> <exclusion> <groupId>org.slf4j</groupId> <artifactId>log4j-over-slf4j</artifactId> @@ -344,11 +352,10 @@ <artifactId>hadoop-hdfs-client</artifactId> <version>${hadoop.hdfs-client.version}</version> </dependency> - <artifactItem> - <groupId>ch.qos.reload4j</groupId> - <artifactId>reload4j</artifactId> - <version>${reload4j.version}</version> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logback.version}</version> </artifactItem> <artifactItem> <groupId>com.sun.jersey</groupId> @@ -444,8 +451,8 @@ <value>application.log</value> </systemProperty> <systemProperty> - <name>log4j.configuration</name> - <value>file:///${project.build.directory}/test-classes/atlas-log4j.xml</value> + <name>logback.configurationFile</name> + <value>file:///${project.build.directory}/test-classes/atlas-logback.xml</value> </systemProperty> <systemProperty> <name>atlas.graphdb.backend</name> diff --git a/addons/storm-bridge/src/test/resources/atlas-log4j.xml b/addons/storm-bridge/src/test/resources/atlas-log4j.xml deleted file mode 100755 index 262a710f7a..0000000000 --- a/addons/storm-bridge/src/test/resources/atlas-log4j.xml +++ /dev/null @@ -1,137 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="AUDIT" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/audit.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="METRICS" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/metric.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="FAILED" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/failed.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %m"/> - </layout> - </appender> - - <!-- Uncomment the following for perf logs --> - <!-- - <appender name="perf_appender" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="file" value="${atlas.log.dir}/atlas_perf.log" /> - <param name="datePattern" value="'.'yyyy-MM-dd" /> - <param name="append" value="true" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d|%t|%m%n" /> - </layout> - </appender> - - <logger name="org.apache.atlas.perf" additivity="false"> - <level value="debug" /> - <appender-ref ref="perf_appender" /> - </logger> - --> - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.janusgraph" additivity="false"> - <level value="warn"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.springframework" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.eclipse" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="com.sun.jersey" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="AUDIT" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <logger name="METRICS" additivity="false"> - <level value="debug"/> - <appender-ref ref="METRICS"/> - </logger> - - <logger name="FAILED" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> diff --git a/addons/storm-bridge/src/test/resources/atlas-logback.xml b/addons/storm-bridge/src/test/resources/atlas-logback.xml new file mode 100755 index 0000000000..78fd420dc8 --- /dev/null +++ b/addons/storm-bridge/src/test/resources/atlas-logback.xml @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/audit.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/audit-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/metrics.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/metrics-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="FAILED" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/failed.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/failed-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.ImpalaLineageTool" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.apache.atlas.impala.hook.ImpalaLineageHook" additivity="false" level="debug"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.janusgraph" additivity="false" level="warn"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.springframework" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.eclipse" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="com.sun.jersey" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="METRICS" additivity="false" level="debug"> + <appender-ref ref="METRICS"/> + </logger> + + <logger name="FAILED" additivity="false" level="info"> + <appender-ref ref="FAILED"/> + </logger> + + <logger name="AUDIT" additivity="false" level="info"> + <appender-ref ref="AUDIT"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/atlas-hub/atlas-logback.xml b/atlas-hub/atlas-logback.xml new file mode 100755 index 0000000000..2479258d6f --- /dev/null +++ b/atlas-hub/atlas-logback.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <root level="info"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/atlas-hub/pre-conf/atlas-log4j.xml b/atlas-hub/pre-conf/atlas-log4j.xml deleted file mode 100644 index 56f1532165..0000000000 --- a/atlas-hub/pre-conf/atlas-log4j.xml +++ /dev/null @@ -1,156 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - </layout> - </appender> - - <appender name="LARGE_MESSAGES" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="{{log_dir}}/large_messages.log"/> - <param name="Append" value="true"/> - <param name="MaxFileSize" value="100MB" /> - <param name="MaxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %m%n"/> - </layout> - </appender> - - <appender name="AUDIT" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="File" value="${atlas.log.dir}/audit.log"/> - <param name="datePattern" value="'.'yyyy-MM-dd-HH-mm" /> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="[%p] %d %c %M - %m%n"/> - - <!--param name="maxFileSize" value="100MB" /--> - <param name="maxBackupIndex" value="120" /> - </layout> - </appender> - - <appender name="METRICS" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="File" value="${atlas.log.dir}/metric.log"/> - <param name="datePattern" value="'.'yyyy-MM-dd-HH-mm" /> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="[%p] %d %c %M - %m%n"/> - <!--param name="maxFileSize" value="100MB" /--> - <param name="maxBackupIndex" value="120" /> - </layout> - </appender> - - <appender name="FAILED" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/failed.log"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %m%n"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - </layout> - </appender> - - <!-- Uncomment the following for perf logs --> - <!-- - <appender name="perf_appender" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="file" value="${atlas.log.dir}/atlas_perf.log" /> - <param name="datePattern" value="'.'yyyy-MM-dd" /> - <param name="append" value="true" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d|%t|%m%n" /> - </layout> - </appender> - - <logger name="org.apache.atlas.perf" additivity="false"> - <level value="debug" /> - <appender-ref ref="perf_appender" /> - </logger> - --> - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.janusgraph" additivity="false"> - <level value="warn"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.springframework" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.eclipse" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="com.sun.jersey" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="AUDIT" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <logger name="LARGE_MESSAGES" additivity="false"> - <level value="warn"/> - <appender-ref ref="LARGE_MESSAGES"/> - </logger> - - <logger name="METRICS" additivity="false"> - <level value="debug"/> - <appender-ref ref="METRICS"/> - </logger> - - <logger name="FAILED" additivity="false"> - <level value="info"/> - <appender-ref ref="FAILED"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> diff --git a/atlas-hub/pre-conf/zookeeper/log4j.properties b/atlas-hub/pre-conf/zookeeper/log4j.properties deleted file mode 100644 index 5f5de78920..0000000000 --- a/atlas-hub/pre-conf/zookeeper/log4j.properties +++ /dev/null @@ -1,75 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -# Define some default values that can be overridden by system properties -zookeeper.root.logger=INFO, CONSOLE -zookeeper.console.threshold=INFO -zookeeper.log.dir=/CHANGE_ME/logs -zookeeper.log.file=zookeeper.log -zookeeper.log.threshold=DEBUG -zookeeper.tracelog.dir=. -zookeeper.tracelog.file=zookeeper_trace.log - -# -# ZooKeeper Logging Configuration -# - -# Format is "<default threshold> (, <appender>)+ - -# DEFAULT: console appender only -log4j.rootLogger=${zookeeper.root.logger} - -# Example with rolling log file -#log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE - -# Example with rolling log file and tracing -#log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE - -# -# Log INFO level and above messages to the console -# -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender -log4j.appender.CONSOLE.Threshold=${zookeeper.console.threshold} -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n - -# -# Add ROLLINGFILE to rootLogger to get log file output -# Log DEBUG level and above messages to a log file -log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender -log4j.appender.ROLLINGFILE.Threshold=${zookeeper.log.threshold} -log4j.appender.ROLLINGFILE.File=${zookeeper.log.dir}/${zookeeper.log.file} - -# Max log file size of 10MB -log4j.appender.ROLLINGFILE.MaxFileSize=10MB -# uncomment the next line to limit number of backup files -#log4j.appender.ROLLINGFILE.MaxBackupIndex=10 - -log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout -log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n - - -# -# Add TRACEFILE to rootLogger to get log file output -# Log DEBUG level and above messages to a log file -log4j.appender.TRACEFILE=org.apache.log4j.FileAppender -log4j.appender.TRACEFILE.Threshold=TRACE -log4j.appender.TRACEFILE.File=${zookeeper.tracelog.dir}/${zookeeper.tracelog.file} - -log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout -### Notice we are including log4j's NDC here (%x) -log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L][%x] - %m%n diff --git a/common/src/test/resources/atlas-log4j.xml b/common/src/test/resources/atlas-log4j.xml deleted file mode 100644 index 4f1551857f..0000000000 --- a/common/src/test/resources/atlas-log4j.xml +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <logger name="org.apache.atlas" additivity="false"> - <level value="debug"/> - <appender-ref ref="console"/> - </logger> - - <!-- uncomment this block to generate performance traces - <appender name="perf_appender" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="file" value="${atlas.log.dir}/atlas_perf.log" /> - <param name="datePattern" value="'.'yyyy-MM-dd" /> - <param name="append" value="true" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d|%t|%m%n" /> - </layout> - </appender> - - <logger name="org.apache.atlas.perf" additivity="false"> - <level value="debug" /> - <appender-ref ref="perf_appender" /> - </logger> - --> - - <logger name="org.janusgraph" additivity="false"> - <level value="warn"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.springframework" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.eclipse" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="com.sun.jersey" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="console"/> - </root> - -</log4j:configuration> diff --git a/common/src/test/resources/atlas-logback.xml b/common/src/test/resources/atlas-logback.xml new file mode 100644 index 0000000000..d82bfa8c30 --- /dev/null +++ b/common/src/test/resources/atlas-logback.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="debug"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.janusgraph" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.springframework" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.eclipse" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="com.sun.jersey" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <root level="warn"> + <appender-ref ref="console"/> + </root> +</configuration> diff --git a/common/src/test/resources/log4j.properties b/common/src/test/resources/log4j.properties deleted file mode 100644 index d62cf80450..0000000000 --- a/common/src/test/resources/log4j.properties +++ /dev/null @@ -1,34 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. - -# A1 is set to be a FileAppender. -log4j.appender.A1=org.apache.log4j.FileAppender -log4j.appender.A1.File=target/test.log -log4j.appender.A1.Threshold=ALL -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5p %c{2}: %m%n - -# A2 is a ConsoleAppender. -log4j.appender.A2=org.apache.log4j.ConsoleAppender -log4j.appender.A2.Threshold=ALL -# A2 uses PatternLayout. -log4j.appender.A2.layout=org.apache.log4j.PatternLayout -log4j.appender.A2.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5p %c{2}: %m%n - -# Set both appenders (A1 and A2) on the root logger. -#log4j.rootLogger=INFO, A1, A2 -log4j.rootLogger=ERROR, A1 diff --git a/tools/atlas-index-repair/src/main/resources/atlas-log4j.xml b/common/src/test/resources/logback.xml similarity index 50% rename from tools/atlas-index-repair/src/main/resources/atlas-log4j.xml rename to common/src/test/resources/logback.xml index 9346a36929..bcd075b660 100644 --- a/tools/atlas-index-repair/src/main/resources/atlas-log4j.xml +++ b/common/src/test/resources/logback.xml @@ -17,26 +17,27 @@ ~ limitations under the License. --> -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="/var/log/atlas/atlas-index-janus-repair.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> + <appender name="FILE" class="ch.qos.logback.core.FileAppender"> + <file>target/test.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + </appender> - <logger name="org.apache.atlas.tools.RepairIndex" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> + <root level="error"> + <appender-ref ref="FILE"/> + </root> +</configuration> - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> -</log4j:configuration> diff --git a/distro/src/bin/atlas_client_cmdline.py b/distro/src/bin/atlas_client_cmdline.py index f05a3c8f96..4f8497be10 100644 --- a/distro/src/bin/atlas_client_cmdline.py +++ b/distro/src/bin/atlas_client_cmdline.py @@ -21,7 +21,7 @@ ATLAS_COMMAND_OPTS="-Datlas.home=%s" ATLAS_LOG_OPTS="-Datlas.log.dir=%s -Datlas.log.file=%s" -DEFAULT_JVM_OPTS="-Xmx1024m -Dlog4j.configuration=atlas-log4j.xml" +DEFAULT_JVM_OPTS="-Xmx1024m -Dlogback.configurationFile=atlas-logback.xml" def setup_conf_dir(): atlas_home = mc.atlasDir() diff --git a/distro/src/bin/atlas_start.py b/distro/src/bin/atlas_start.py index e8cf81d82b..a2016c18ba 100755 --- a/distro/src/bin/atlas_start.py +++ b/distro/src/bin/atlas_start.py @@ -25,7 +25,7 @@ ATLAS_COMMAND_OPTS="-Datlas.home=%s" ATLAS_CONFIG_OPTS="-Datlas.conf=%s" DEFAULT_JVM_HEAP_OPTS="-Xmx1024m" -DEFAULT_JVM_OPTS="-Dlog4j.configuration=atlas-log4j.xml -Djava.net.preferIPv4Stack=true -server" +DEFAULT_JVM_OPTS="-Dlogback.configurationFile=atlas-logback.xml -Djava.net.preferIPv4Stack=true -server" JOLOKIA_JVM_OPTS="-javaagent:/opt/apache-atlas/libext/jolokia-jvm-agent.jar=port=7777,host=0.0.0.0" def main(): diff --git a/distro/src/conf/atlas-log4j.xml b/distro/src/conf/atlas-log4j.xml deleted file mode 100755 index 90e1301a1e..0000000000 --- a/distro/src/conf/atlas-log4j.xml +++ /dev/null @@ -1,167 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="LARGE_MESSAGES" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/large_messages.log"/> - <param name="Append" value="true"/> - <param name="MaxFileSize" value="100MB" /> - <param name="MaxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %m%n"/> - </layout> - </appender> - - <appender name="AUDIT" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/audit.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="TASKS" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/tasks.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="259MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%t %d %x %m%n (%C{1}:%L)"/> - </layout> - </appender> - - <appender name="METRICS" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/metric.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <appender name="FAILED" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/failed.log"/> - <param name="Append" value="true"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %m%n"/> - </layout> - </appender> - - <!-- Uncomment the following for perf logs --> - <!-- - <appender name="perf_appender" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="file" value="${atlas.log.dir}/atlas_perf.log" /> - <param name="datePattern" value="'.'yyyy-MM-dd" /> - <param name="append" value="true" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d|%t|%m%n" /> - </layout> - </appender> - - <logger name="org.apache.atlas.perf" additivity="false"> - <level value="debug" /> - <appender-ref ref="perf_appender" /> - </logger> - --> - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.janusgraph" additivity="false"> - <level value="warn"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.springframework" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.eclipse" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="com.sun.jersey" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="AUDIT" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <logger name="LARGE_MESSAGES" additivity="false"> - <level value="warn"/> - <appender-ref ref="LARGE_MESSAGES"/> - </logger> - - <logger name="METRICS" additivity="false"> - <level value="debug"/> - <appender-ref ref="METRICS"/> - </logger> - - <logger name="FAILED" additivity="false"> - <level value="info"/> - <appender-ref ref="FAILED"/> - </logger> - - <logger name="TASKS" additivity="false"> - <level value="info"/> - <appender-ref ref="TASKS"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> diff --git a/distro/src/conf/atlas-logback.xml b/distro/src/conf/atlas-logback.xml new file mode 100755 index 0000000000..2e30561116 --- /dev/null +++ b/distro/src/conf/atlas-logback.xml @@ -0,0 +1,177 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="LARGE_MESSAGES" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/large_messages.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/large_messages-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/audit.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/audit-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="TASKS" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/tasks.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/tasks-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/metrics.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/metrics-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="FAILED" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/failed.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/failed-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <!-- Uncomment the following for perf logs --> + <!-- + <appender name="perf_appender" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/atlas_perf.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/atlas_perf-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="perf_appender" additivity="false" level="debug"> + <appender-ref ref="perf_appender"/> + </logger> + --> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.janusgraph" additivity="false" level="warn"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.springframework" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.eclipse" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="com.sun.jersey" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="AUDIT" additivity="false" level="info"> + <appender-ref ref="AUDIT"/> + </logger> + + <logger name="LARGE_MESSAGES" additivity="false" level="warn"> + <appender-ref ref="LARGE_MESSAGES"/> + </logger> + + <logger name="METRICS" additivity="false" level="debug"> + <appender-ref ref="METRICS"/> + </logger> + + <logger name="FAILED" additivity="false" level="info"> + <appender-ref ref="FAILED"/> + </logger> + + <logger name="TASKS" additivity="false" level="info"> + <appender-ref ref="TASKS"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/distro/src/conf/zookeeper/log4j.properties b/distro/src/conf/zookeeper/log4j.properties deleted file mode 100755 index 5f5de78920..0000000000 --- a/distro/src/conf/zookeeper/log4j.properties +++ /dev/null @@ -1,75 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -# Define some default values that can be overridden by system properties -zookeeper.root.logger=INFO, CONSOLE -zookeeper.console.threshold=INFO -zookeeper.log.dir=/CHANGE_ME/logs -zookeeper.log.file=zookeeper.log -zookeeper.log.threshold=DEBUG -zookeeper.tracelog.dir=. -zookeeper.tracelog.file=zookeeper_trace.log - -# -# ZooKeeper Logging Configuration -# - -# Format is "<default threshold> (, <appender>)+ - -# DEFAULT: console appender only -log4j.rootLogger=${zookeeper.root.logger} - -# Example with rolling log file -#log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE - -# Example with rolling log file and tracing -#log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE - -# -# Log INFO level and above messages to the console -# -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender -log4j.appender.CONSOLE.Threshold=${zookeeper.console.threshold} -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n - -# -# Add ROLLINGFILE to rootLogger to get log file output -# Log DEBUG level and above messages to a log file -log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender -log4j.appender.ROLLINGFILE.Threshold=${zookeeper.log.threshold} -log4j.appender.ROLLINGFILE.File=${zookeeper.log.dir}/${zookeeper.log.file} - -# Max log file size of 10MB -log4j.appender.ROLLINGFILE.MaxFileSize=10MB -# uncomment the next line to limit number of backup files -#log4j.appender.ROLLINGFILE.MaxBackupIndex=10 - -log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout -log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n - - -# -# Add TRACEFILE to rootLogger to get log file output -# Log DEBUG level and above messages to a log file -log4j.appender.TRACEFILE=org.apache.log4j.FileAppender -log4j.appender.TRACEFILE.Threshold=TRACE -log4j.appender.TRACEFILE.File=${zookeeper.tracelog.dir}/${zookeeper.tracelog.file} - -log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout -### Notice we are including log4j's NDC here (%x) -log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L][%x] - %m%n diff --git a/distro/src/conf/zookeeper/logback.xml b/distro/src/conf/zookeeper/logback.xml new file mode 100644 index 0000000000..3e08b92ae7 --- /dev/null +++ b/distro/src/conf/zookeeper/logback.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="TRACEFILE" class="ch.qos.logback.core.FileAppender"> + <file>./zookeeper_trace.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + </appender> + + <appender name="ROLLINGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>./zookeeper.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>./zookeeper-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <root level="info"> + <appender-ref ref="console"/> + </root> +</configuration> + diff --git a/distro/src/main/assemblies/atlas-server-package.xml b/distro/src/main/assemblies/atlas-server-package.xml index 9eb71ef7cf..d6b99128d3 100755 --- a/distro/src/main/assemblies/atlas-server-package.xml +++ b/distro/src/main/assemblies/atlas-server-package.xml @@ -96,7 +96,7 @@ <includes> <include>README</include> <include>*.py</include> - <include>atlas-log4j.xml</include> + <include>atlas-logback.xml</include> <include>atlas-migration-*.jar</include> </includes> <fileMode>0755</fileMode> @@ -109,7 +109,7 @@ <outputDirectory>tools/classification-updater</outputDirectory> <includes> <include>*.sh</include> - <include>atlas-log4j.xml</include> + <include>atlas-logback.xml</include> </includes> <fileMode>0755</fileMode> <directoryMode>0755</directoryMode> diff --git a/distro/src/main/assemblies/classification-updater.xml b/distro/src/main/assemblies/classification-updater.xml index 03a9b68613..2462e5b5c0 100644 --- a/distro/src/main/assemblies/classification-updater.xml +++ b/distro/src/main/assemblies/classification-updater.xml @@ -37,7 +37,7 @@ <outputDirectory>.</outputDirectory> <includes> <include>*.sh</include> - <include>atlas-log4j.xml</include> + <include>atlas-logback.xml</include> </includes> <fileMode>0755</fileMode> <directoryMode>0755</directoryMode> diff --git a/distro/src/main/assemblies/migration-exporter.xml b/distro/src/main/assemblies/migration-exporter.xml index 4907a683c6..32de825891 100644 --- a/distro/src/main/assemblies/migration-exporter.xml +++ b/distro/src/main/assemblies/migration-exporter.xml @@ -38,7 +38,7 @@ <includes> <include>*.py</include> <include>migrationContext.xml</include> - <include>atlas-log4j.xml</include> + <include>atlas-logback.xml</include> <include>README</include> </includes> <fileMode>0755</fileMode> diff --git a/distro/src/main/assemblies/notification-analyzer.xml b/distro/src/main/assemblies/notification-analyzer.xml new file mode 100644 index 0000000000..eee78f6c49 --- /dev/null +++ b/distro/src/main/assemblies/notification-analyzer.xml @@ -0,0 +1,71 @@ +<!-- +** +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you 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. +* +* +--> +<assembly> + <id>notification-analyzer</id> + <formats> + <format>zip</format> + </formats> + + <baseDirectory>notification-analyzer</baseDirectory> + + <fileSets> + <fileSet> + <includes> + <include>README*</include> + </includes> + </fileSet> + <fileSet> + <directory>../tools/notification-analyzer/target/dependency</directory> + <outputDirectory>.</outputDirectory> + </fileSet> + <fileSet> + <directory>../tools/notification-analyzer/scripts</directory> + <outputDirectory>.</outputDirectory> + <includes> + <include>*.sh</include> + </includes> + <fileMode>0755</fileMode> + <directoryMode>0755</directoryMode> + </fileSet> + <fileSet> + <directory>../tools/notification-analyzer/src/main/resources</directory> + <outputDirectory>.</outputDirectory> + <includes> + <include>atlas-logback.xml</include> + <include>atlas-application.properties</include> + </includes> + </fileSet> + <fileSet> + <directory>../tools/notification-analyzer</directory> + <outputDirectory>.</outputDirectory> + <includes> + <include>README</include> + </includes> + </fileSet> + <fileSet> + <directory>../tools/notification-analyzer/target</directory> + <outputDirectory>.</outputDirectory> + <includes> + <include>atlas-notification-analyzer-${project.version}.jar</include> + </includes> + </fileSet> + </fileSets> +</assembly> diff --git a/distro/src/main/assemblies/standalone-package.xml b/distro/src/main/assemblies/standalone-package.xml index 3ef91c047e..8305f77b1d 100755 --- a/distro/src/main/assemblies/standalone-package.xml +++ b/distro/src/main/assemblies/standalone-package.xml @@ -211,7 +211,7 @@ <includes> <include>README</include> <include>*.py</include> - <include>atlas-log4j.xml</include> + <include>atlas-logback.xml</include> <include>atlas-migration-*.jar</include> <include>migrationContext.xml</include> </includes> diff --git a/distro/src/test/python/scripts/TestMetadata.py b/distro/src/test/python/scripts/TestMetadata.py index 205da0e750..ea2e413a19 100644 --- a/distro/src/test/python/scripts/TestMetadata.py +++ b/distro/src/test/python/scripts/TestMetadata.py @@ -128,8 +128,8 @@ def test_main_embedded(self, wait_for_startup_mock, is_solr_local_mock, is_hbase ['-app', 'atlas_home\\server\\webapp\\atlas'], 'atlas_home\\conf;atlas_home\\server\\webapp\\atlas\\WEB-INF\\classes;atlas_home\\server\\webapp\\atlas\\WEB-INF\\lib\\*;atlas_home\\libext\\*;atlas_home\\hbase\\conf', ['-Datlas.log.dir=atlas_home\\logs', '-Datlas.log.file=application.log', '-Datlas.home=atlas_home', - '-Datlas.conf=atlas_home\\conf', '-Xmx1024m', "-javaagent:/opt/apache-atlas/libext/jolokia-jvm-agent.jar=port=7777,host=0.0.0.0", - '-Dlog4j.configuration=atlas-log4j.xml', '-Djava.net.preferIPv4Stack=true', '-server'], + '-Datlas.conf=atlas_home\\conf', '-Xmx1024m', + '-Dlogback.configurationFile=atlas-logback.xml', '-Djava.net.preferIPv4Stack=true', '-server'], 'atlas_home\\logs') else: @@ -139,7 +139,7 @@ def test_main_embedded(self, wait_for_startup_mock, is_solr_local_mock, is_hbase 'atlas_home/conf:atlas_home/server/webapp/atlas/WEB-INF/classes:atlas_home/server/webapp/atlas/WEB-INF/lib/*:atlas_home/libext/*:atlas_home/hbase/conf', ['-Datlas.log.dir=atlas_home/logs', '-Datlas.log.file=application.log', '-Datlas.home=atlas_home', '-Datlas.conf=atlas_home/conf', '-Xmx1024m',"-javaagent:/opt/apache-atlas/libext/jolokia-jvm-agent.jar=port=7777,host=0.0.0.0", - '-Dlog4j.configuration=atlas-log4j.xml', '-Djava.net.preferIPv4Stack=true', '-server'], + '-Dlogback.configurationFile=atlas-logback.xml', '-Djava.net.preferIPv4Stack=true', '-server'], 'atlas_home/logs') pass @@ -221,8 +221,8 @@ def test_main_default(self, wait_for_startup_mock, is_solr_local_mock, is_hbase_ ['-app', 'atlas_home\\server\\webapp\\atlas'], 'atlas_home\\conf;atlas_home\\server\\webapp\\atlas\\WEB-INF\\classes;atlas_home\\server\\webapp\\atlas\\WEB-INF\\lib\\*;atlas_home\\libext\\*;atlas_home\\hbase\\conf', ['-Datlas.log.dir=atlas_home\\logs', '-Datlas.log.file=application.log', '-Datlas.home=atlas_home', - '-Datlas.conf=atlas_home\\conf', '-Xmx1024m', "-javaagent:/opt/apache-atlas/libext/jolokia-jvm-agent.jar=port=7777,host=0.0.0.0", - '-Dlog4j.configuration=atlas-log4j.xml', '-Djava.net.preferIPv4Stack=true', '-server'], + '-Datlas.conf=atlas_home\\conf', '-Xmx1024m', "-javaagent:/opt/apache-atlas/libext/jolokia-jvm-agent.jar=port=7777,host=0.0.0.0", + '-Dlogback.configurationFile=atlas-logback.xml', '-Djava.net.preferIPv4Stack=true', '-server'], 'atlas_home\\logs') else: @@ -232,7 +232,7 @@ def test_main_default(self, wait_for_startup_mock, is_solr_local_mock, is_hbase_ 'atlas_home/conf:atlas_home/server/webapp/atlas/WEB-INF/classes:atlas_home/server/webapp/atlas/WEB-INF/lib/*:atlas_home/libext/*:atlas_home/hbase/conf', ['-Datlas.log.dir=atlas_home/logs', '-Datlas.log.file=application.log', '-Datlas.home=atlas_home', '-Datlas.conf=atlas_home/conf', '-Xmx1024m',"-javaagent:/opt/apache-atlas/libext/jolokia-jvm-agent.jar=port=7777,host=0.0.0.0", - '-Dlog4j.configuration=atlas-log4j.xml', '-Djava.net.preferIPv4Stack=true', '-server'], + '-Dlogback.configurationFile=atlas-logback.xml', '-Djava.net.preferIPv4Stack=true', '-server'], 'atlas_home/logs') pass diff --git a/intg/src/main/resources/atlas-log4j.xml b/intg/src/main/resources/atlas-log4j.xml deleted file mode 100755 index 13a7f96844..0000000000 --- a/intg/src/main/resources/atlas-log4j.xml +++ /dev/null @@ -1,105 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="AUDIT" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/audit.log"/> - <param name="Append" value="true"/> - <param name="Threshold" value="debug"/> - <param name="maxFileSize" value="100MB" /> - <param name="maxBackupIndex" value="20" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %x %m%n"/> - </layout> - </appender> - - <logger name="org.apache.atlas" additivity="false"> - <level value="debug"/> - <appender-ref ref="console"/> - </logger> - - <!-- uncomment this block to generate performance traces - <appender name="perf_appender" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="file" value="${atlas.log.dir}/atlas_perf.log" /> - <param name="datePattern" value="'.'yyyy-MM-dd" /> - <param name="append" value="true" /> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d|%t|%m%n" /> - </layout> - </appender> - - <logger name="org.apache.atlas.perf" additivity="false"> - <level value="debug" /> - <appender-ref ref="perf_appender" /> - </logger> - --> - - <appender name="FAILED" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="File" value="${atlas.log.dir}/failed.log"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %m"/> - </layout> - </appender> - - <logger name="FAILED" additivity="false"> - <level value="info"/> - <appender-ref ref="AUDIT"/> - </logger> - - <logger name="org.janusgraph" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.springframework" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.eclipse" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="com.sun.jersey" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="AUDIT" additivity="false"> - <level value="info"/> - <appender-ref ref="console"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="console"/> - </root> - -</log4j:configuration> diff --git a/intg/src/main/resources/atlas-logback.xml b/intg/src/main/resources/atlas-logback.xml new file mode 100755 index 0000000000..7405274826 --- /dev/null +++ b/intg/src/main/resources/atlas-logback.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/audit.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/audit-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="FAILED" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/failed.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/failed-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.janusgraph" additivity="false" level="warn"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.springframework" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.eclipse" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="com.sun.jersey" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="FAILED" additivity="false" level="info"> + <appender-ref ref="FAILED"/> + </logger> + + <logger name="AUDIT" additivity="false" level="info"> + <appender-ref ref="AUDIT"/> + </logger> + + <root level="warn"> + <appender-ref ref="console"/> + </root> +</configuration> diff --git a/notification/pom.xml b/notification/pom.xml index 4d7c810708..e29e8ce1b3 100644 --- a/notification/pom.xml +++ b/notification/pom.xml @@ -56,15 +56,9 @@ </dependency> <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>${log4j2.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - <version>${log4j2.version}</version> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logback.version}</version> </dependency> <dependency> @@ -89,13 +83,6 @@ <scope>test</scope> </dependency> - <dependency> - <groupId>ch.qos.reload4j</groupId> - <artifactId>reload4j</artifactId> - <version>${reload4j.version}</version> - <scope>compile</scope> - </dependency> - </dependencies> <build> @@ -166,11 +153,6 @@ <artifactId>slf4j-log4j12</artifactId> <version>${slf4j.version}</version> </artifactItem> - <artifactItem> - <groupId>ch.qos.reload4j</groupId> - <artifactId>reload4j</artifactId> - <version>${reload4j.version}</version> - </artifactItem> <artifactItem> <groupId>org.apache.kafka</groupId> <artifactId>kafka_${kafka.scala.binary.version}</artifactId> diff --git a/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java index 24ea6ea836..980db4812f 100644 --- a/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java +++ b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java @@ -63,6 +63,9 @@ public abstract class AtlasHook { public static final String CONF_METADATA_NAMESPACE = "atlas.metadata.namespace"; public static final String CLUSTER_NAME_KEY = "atlas.cluster.name"; public static final String DEFAULT_CLUSTER_NAME = "primary"; + public static final String CONF_ATLAS_HOOK_MESSAGES_SORT_ENABLED = "atlas.hook.messages.sort.enabled"; + public static final String ATLAS_HOOK_ENTITY_IGNORE_PATTERN = "atlas.hook.entity.ignore.pattern"; + public static final String ATTRIBUTE_QUALIFIED_NAME = "qualifiedName"; protected static Configuration atlasProperties; protected static NotificationInterface notificationInterface; @@ -84,17 +87,16 @@ public abstract class AtlasHook { LOG.info("Failed to load application properties", e); } - String failedMessageFile = atlasProperties.getString(ATLAS_NOTIFICATION_FAILED_MESSAGES_FILENAME_KEY, ATLAS_HOOK_FAILED_MESSAGES_LOG_DEFAULT_NAME); - logFailedMessages = atlasProperties.getBoolean(ATLAS_NOTIFICATION_LOG_FAILED_MESSAGES_ENABLED_KEY, true); if (logFailedMessages) { - failedMessagesLogger = new FailedMessagesLogger(failedMessageFile); - failedMessagesLogger.init(); + failedMessagesLogger = new FailedMessagesLogger(); } else { failedMessagesLogger = null; } + isRESTNotificationEnabled = AtlasConfiguration.NOTIFICATION_HOOK_REST_ENABLED.getBoolean(); + isHookMsgsSortEnabled = atlasProperties.getBoolean(CONF_ATLAS_HOOK_MESSAGES_SORT_ENABLED, isRESTNotificationEnabled); metadataNamespace = getMetadataNamespace(atlasProperties); notificationMaxRetries = atlasProperties.getInt(ATLAS_NOTIFICATION_MAX_RETRIES, 3); notificationRetryInterval = atlasProperties.getInt(ATLAS_NOTIFICATION_RETRY_INTERVAL, 1000); diff --git a/notification/src/main/java/org/apache/atlas/hook/FailedMessagesLogger.java b/notification/src/main/java/org/apache/atlas/hook/FailedMessagesLogger.java index 5488c1c2ce..840e59ceeb 100644 --- a/notification/src/main/java/org/apache/atlas/hook/FailedMessagesLogger.java +++ b/notification/src/main/java/org/apache/atlas/hook/FailedMessagesLogger.java @@ -19,48 +19,17 @@ package org.apache.atlas.hook; -import org.apache.atlas.notification.LogConfigUtils; -import org.apache.log4j.DailyRollingFileAppender; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.apache.log4j.PatternLayout; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import java.io.File; -import java.io.IOException; /** * A logger wrapper that can be used to write messages that failed to be sent to a log file. */ public class FailedMessagesLogger { - - public static final String PATTERN_SPEC_TIMESTAMP_MESSAGE_NEWLINE = "%d{ISO8601} %m%n"; - public static final String DATE_PATTERN = ".yyyy-MM-dd"; - - private final Logger logger = Logger.getLogger("org.apache.atlas.hook.FailedMessagesLogger"); - private String failedMessageFile; - - public FailedMessagesLogger(String failedMessageFile) { - this.failedMessageFile = failedMessageFile; - } - - void init() { - String rootLoggerDirectory = LogConfigUtils.getRootDir(); - if (rootLoggerDirectory == null) { - return; - } - String absolutePath = new File(rootLoggerDirectory, failedMessageFile).getAbsolutePath(); - try { - DailyRollingFileAppender failedLogFilesAppender = new DailyRollingFileAppender( - new PatternLayout(PATTERN_SPEC_TIMESTAMP_MESSAGE_NEWLINE), absolutePath, DATE_PATTERN); - logger.addAppender(failedLogFilesAppender); - logger.setLevel(Level.ERROR); - logger.setAdditivity(false); - } catch (IOException e) { - e.printStackTrace(); - } - } + private static final Logger LOG = LoggerFactory.getLogger(FailedMessagesLogger.class); public void log(String message) { - logger.error(message); + LOG.info(message); } } diff --git a/notification/src/main/java/org/apache/atlas/notification/LogConfigUtils.java b/notification/src/main/java/org/apache/atlas/notification/LogConfigUtils.java index ea9c1cecca..e69de29bb2 100644 --- a/notification/src/main/java/org/apache/atlas/notification/LogConfigUtils.java +++ b/notification/src/main/java/org/apache/atlas/notification/LogConfigUtils.java @@ -1,159 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ -package org.apache.atlas.notification; - -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.util.Enumeration; - -public class LogConfigUtils { - private static final Logger LOG = LoggerFactory.getLogger(LogConfigUtils.class); - - public static String getRootDir() { - String ret = getFileAppenderPath(); - - if (StringUtils.isEmpty(ret)) { - ret = getFileAppenderPathApproach2(); - } - - if (StringUtils.isNotEmpty(ret)) { - ret = StringUtils.substringBeforeLast(ret, File.separator); - } else { - ret = null; - } - - LOG.info("getRootDir(): ret={}", ret); - - return ret; - } - - private static String getFileAppenderPath() { - String ret = StringUtils.EMPTY; - - try { - org.apache.logging.log4j.core.LoggerContext loggerContext = (org.apache.logging.log4j.core.LoggerContext) org.apache.logging.log4j.LogManager.getContext(); - org.apache.logging.log4j.core.config.Configuration configuration = loggerContext.getConfiguration(); - - String rrfaFilename = null; - String rfaFilename = null; - String faFilename = null; - - // get log file path in the following order: - // 1. first RollingRandomAccessFileAppender - // 2. first RollingFileAppender, if no RollingRandomAccessFileAppender is found - // 3. first FileAppender, if no RollingFileAppender is found - for (org.apache.logging.log4j.core.Appender appender : configuration.getAppenders().values()) { - if (rrfaFilename == null && appender instanceof org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender) { - org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender fileAppender = (org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender) appender; - - rrfaFilename = fileAppender.getFileName(); - - LOG.debug("RollingRandomAccessFileAppender(name={}, fileName={})", fileAppender.getName(), fileAppender.getFileName()); - } else if (rfaFilename == null && appender instanceof org.apache.logging.log4j.core.appender.RollingFileAppender) { - org.apache.logging.log4j.core.appender.RollingFileAppender fileAppender = (org.apache.logging.log4j.core.appender.RollingFileAppender) appender; - - rfaFilename = fileAppender.getFileName(); - - LOG.debug("RollingFileAppender(name={}, fileName={})", fileAppender.getName(), fileAppender.getFileName()); - } else if (faFilename == null && appender instanceof org.apache.logging.log4j.core.appender.FileAppender) { - org.apache.logging.log4j.core.appender.FileAppender fileAppender = (org.apache.logging.log4j.core.appender.FileAppender) appender; - - faFilename = fileAppender.getFileName(); - - LOG.debug("FileAppender(name={}, fileName={})", fileAppender.getName(), fileAppender.getFileName()); - } else { - LOG.info("Could not infer log path from this appender: {}", appender.getClass().getName()); - } - } - - if (rrfaFilename != null) { - ret = rrfaFilename; - } else if (rfaFilename != null) { - ret = rfaFilename; - } else if (faFilename != null) { - ret = faFilename; - } - - LOG.info("getFileAppenderPath(): ret={}", ret); - } catch (Throwable t) { - LOG.info("getFileAppenderPath(): failed to get log path from org.apache.logging.log4j. error: {}", t.getMessage()); - } - - return ret; - } - - private static String getFileAppenderPathApproach2() { - String ret = StringUtils.EMPTY; - - try { - org.apache.log4j.Logger rootLogger = org.apache.log4j.Logger.getRootLogger(); - Enumeration allAppenders = rootLogger.getAllAppenders(); - - if (allAppenders != null) { - String drfaFilename = null; - String rfaFilename = null; - String faFilename = null; - - // get log file path in the following order: - // 1. first DailyRollingFileAppender - // 2. first RollingFileAppender, if no DailyRollingFileAppender is found - // 3. first FileAppender, if no RollingFileAppender is found - while (allAppenders.hasMoreElements()) { - Object appender = allAppenders.nextElement(); - - if (drfaFilename == null && appender instanceof org.apache.log4j.DailyRollingFileAppender) { - org.apache.log4j.DailyRollingFileAppender fileAppender = (org.apache.log4j.DailyRollingFileAppender) appender; - - drfaFilename = fileAppender.getFile(); - - LOG.debug("DailyRollingFileAppender(name={}, file={})", fileAppender.getName(), fileAppender.getFile()); - } else if (rfaFilename == null && appender instanceof org.apache.log4j.RollingFileAppender) { - org.apache.log4j.RollingFileAppender fileAppender = (org.apache.log4j.RollingFileAppender) appender; - - rfaFilename = fileAppender.getFile(); - - LOG.debug("RollingFileAppender(name={}, file={}, append={})", fileAppender.getName(), fileAppender.getFile()); - } else if (faFilename == null && appender instanceof org.apache.log4j.FileAppender) { - org.apache.log4j.FileAppender fileAppender = (org.apache.log4j.FileAppender) appender; - - faFilename = fileAppender.getFile(); - - LOG.debug("FileAppender(name={}, file={}, append={})", fileAppender.getName(), fileAppender.getFile()); - } - } - - if (drfaFilename != null) { - ret = drfaFilename; - } else if (rfaFilename != null) { - ret = rfaFilename; - } else if (faFilename != null) { - ret = faFilename; - } - } - - LOG.info("getFileAppenderPathApproach2(): ret={}", ret); - } catch (Throwable t) { - LOG.error("getFileAppenderPathApproach2(): failed to get log path from org.apache.log4j.", t); - } - - return ret; - } -} diff --git a/pom.xml b/pom.xml index 45bbee7382..77214c65db 100644 --- a/pom.xml +++ b/pom.xml @@ -164,14 +164,14 @@ <developer> <id>bstortz</id> <name>Barbara Stortz</name> - <email>bstortz@sap.com</email> + <email>barbara.stortz@gmail.com</email> <timezone>America/Los_Angeles</timezone> <roles> <role>committer</role> <role>PMC</role> </roles> - <organization>SAP Inc.</organization> - <!--<organizationUrl>https://www.sap.com</organizationUrl>--> + <organization>Microsoft</organization> + <!--<organizationUrl>https://www.microsoft.com</organizationUrl>--> </developer> <developer> <id>chyzer</id> @@ -383,6 +383,16 @@ <organization>Privacera Inc</organization> <!--<organizationUrl>https://www.privacera.com</organizationUrl>--> </developer> + <developer> + <id>mandarambawane</id> + <name>Mandar Ambawane</name> + <email>mandarambawane@apache.org</email> + <timezone>Asia/Kolkata</timezone> + <roles> + <role>committer</role> + </roles> + <organization>Freestone Infotech</organization> + </developer> <developer> <id>mandy</id> <name>Mandy Chessell</name> @@ -449,6 +459,37 @@ </roles> <organization>Freestone Infotech</organization> </developer> + <developer> + <id>ppawar</id> + <name>Prasad Pawar</name> + <email>ppawar@apache.org</email> + <timezone>Asia/Kolkata</timezone> + <roles> + <role>committer</role> + </roles> + <organization>Freestone Infotech</organization> + </developer> + <developer> + <id>chaitalithombare</id> + <name>Chaitali Borole</name> + <email>chaitalithombare@apache.org</email> + <timezone>Asia/Kolkata</timezone> + <roles> + <role>committer</role> + </roles> + <organization>Freestone Infotech</organization> + </developer> + <developer> + <id>radhikakundam</id> + <name>Radhika Kundam</name> + <email>radhikakundam@apache.org</email> + <timezone>America/Los_Angeles</timezone> + <roles> + <role>committer</role> + </roles> + <organization>Cloudera Inc.</organization> + <!--<organizationUrl>https://www.cloudera.com</organizationUrl>--> + </developer> <developer> <id>rmani</id> <name>Ramesh Mani</name> @@ -634,7 +675,7 @@ </property> </activation> <properties> - <distro.exclude.packages>WEB-INF/lib/je-*.jar,WEB-INF/lib/solr-test-framework-*.jar, WEB-INF/lib/jts-*.jar,WEB-INF/lib/logback-*.jar,WEB-INF/lib/dom4j-*.jar,WEB-INF/lib/ant-*.jar</distro.exclude.packages> + <distro.exclude.packages>WEB-INF/lib/je-*.jar,WEB-INF/lib/solr-test-framework-*.jar, WEB-INF/lib/jts-*.jar,WEB-INF/lib/dom4j-*.jar,WEB-INF/lib/ant-*.jar</distro.exclude.packages> <graph.index.backend>solr</graph.index.backend> <graphArtifact>atlas-graphdb-janus</graphArtifact> <graphdb.backend.impl>org.apache.atlas.repository.graphdb.janus.AtlasJanusGraphDatabase</graphdb.backend.impl> @@ -653,7 +694,7 @@ </property> </activation> <properties> - <distro.exclude.packages>WEB-INF/lib/je-*.jar,WEB-INF/lib/solr-test-framework-*.jar, WEB-INF/lib/jts-*.jar,WEB-INF/lib/logback-*.jar,WEB-INF/lib/dom4j-*.jar,WEB-INF/lib/ant-*.jar</distro.exclude.packages> + <distro.exclude.packages>WEB-INF/lib/je-*.jar,WEB-INF/lib/solr-test-framework-*.jar, WEB-INF/lib/jts-*.jar,WEB-INF/lib/dom4j-*.jar,WEB-INF/lib/ant-*.jar</distro.exclude.packages> <graph.index.backend>solr</graph.index.backend> <graphArtifact>atlas-graphdb-janus</graphArtifact> <graphdb.backend.impl>org.apache.atlas.repository.graphdb.janus.AtlasJanusGraphDatabase</graphdb.backend.impl> @@ -680,6 +721,7 @@ <aopalliance.version>1.0</aopalliance.version> <aspectj.runtime.version>1.8.7</aspectj.runtime.version> <atlas.surefire.options></atlas.surefire.options> + <avro.version>1.7.5</avro.version> <calcite.version>1.16.0</calcite.version> <checkstyle.failOnViolation>false</checkstyle.failOnViolation> <codehaus.woodstox.stax2-api.version>3.1.4</codehaus.woodstox.stax2-api.version> @@ -719,8 +761,12 @@ <jackson.version>2.12.4</jackson.version> <janusgraph.version>0.6.03</janusgraph.version> <janusgraph.cassandra.version>0.5.3</janusgraph.cassandra.version> + <jaxb.api.version>2.3.1</jaxb.api.version> <javax-inject.version>1</javax-inject.version> <javax.servlet.version>3.1.0</javax.servlet.version> + <java.version.required>1.8</java.version.required> + <javac.source.version>1.8</javac.source.version> + <javac.target.version>1.8</javac.target.version> <jersey-spring.version>1.19.4</jersey-spring.version> <jersey.version>1.19</jersey.version> <jettison.version>1.3.7</jettison.version> @@ -737,8 +783,7 @@ <keycloak.version>15.0.2.1</keycloak.version> <owasp-html-sanitizer.version>20220608.1</owasp-html-sanitizer.version> <launch-darkly.version>6.0.5</launch-darkly.version> - <reload4j.version>1.2.19</reload4j.version> - <log4j2.version>2.17.1</log4j2.version> + <logback.version>1.3.14</logback.version> <lucene-solr.version>8.8.2</lucene-solr.version> <maven-site-plugin.version>3.7</maven-site-plugin.version> <MaxPermGen>512m</MaxPermGen> @@ -761,8 +806,8 @@ <skipSite>true</skipSite> <skipTests>false</skipTests> <skipUTs>false</skipUTs> + <slf4j.version>2.0.16</slf4j.version> <skipOverlay>false</skipOverlay> - <slf4j.version>1.7.30</slf4j.version> <solr-test-framework.version>8.6.3</solr-test-framework.version> <solr.version>8.6.3</solr.version> <spray.version>1.3.1</spray.version> @@ -926,43 +971,44 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>${slf4j.version}</version> - <exclusions> - <exclusion> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>${slf4j.version}</version> - <exclusions> - <exclusion> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>jul-to-slf4j</artifactId> <version>${slf4j.version}</version> - <exclusions> - <exclusion> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> - <groupId>ch.qos.reload4j</groupId> - <artifactId>reload4j</artifactId> - <version>${reload4j.version}</version> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>${jaxb.api.version}</version> </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>log4j-over-slf4j</artifactId> + <version>${slf4j.version}</version> + </dependency> + + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logback.version}</version> + </dependency> + + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <version>${logback.version}</version> + </dependency> + <!-- hadoop --> <dependency> <groupId>org.apache.hadoop</groupId> @@ -1006,11 +1052,18 @@ <artifactId>junit</artifactId> </exclusion> <exclusion> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> + <groupId>org.apache.commons</groupId> + <artifactId>commons-configuration2</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.commons</groupId> + <artifactId>commons-text</artifactId> + </exclusion> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-reload4j</artifactId> </exclusion> </exclusions> - </dependency> <dependency> @@ -1973,7 +2026,7 @@ <atlas.data>${project.build.directory}/data</atlas.data> <atlas.log.dir>${project.build.directory}/logs</atlas.log.dir> <atlas.log.file>application.log</atlas.log.file> - <log4j.configuration>atlas-log4j.xml</log4j.configuration> + <logback.configurationFile>atlas-logback.xml</logback.configurationFile> <embedded.solr.directory>${project.basedir}/target</embedded.solr.directory> </systemProperties> <skipTests>${skipTests}</skipTests> @@ -2005,7 +2058,7 @@ <atlas.data>${project.build.directory}/data</atlas.data> <atlas.log.dir>${project.build.directory}/logs</atlas.log.dir> <atlas.log.file>application.log</atlas.log.file> - <log4j.configuration>atlas-log4j.xml</log4j.configuration> + <logback.configurationFile>atlas-logback.xml</logback.configurationFile> <embedded.solr.directory>${project.basedir}/target</embedded.solr.directory> </systemPropertyVariables> <redirectTestOutputToFile>true</redirectTestOutputToFile> @@ -2139,7 +2192,7 @@ <exclude>**/docz-lib/**</exclude> <exclude>**/.docz/**</exclude> <exclude>**/*.svg</exclude> - + </excludes> </configuration> <executions> diff --git a/test-tools/pom.xml b/test-tools/pom.xml index 991fa14c9a..92b7a2090c 100644 --- a/test-tools/pom.xml +++ b/test-tools/pom.xml @@ -52,10 +52,6 @@ <groupId>com.github.ben-manes.caffeine</groupId> <artifactId>caffeine</artifactId> </exclusion> - <exclusion> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - </exclusion> <exclusion> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-1.2-api</artifactId> @@ -92,6 +88,24 @@ <version>${project.version}</version> <scope>provided</scope> </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>log4j-over-slf4j</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <scope>test</scope> + </dependency> </dependencies> <build> diff --git a/test-tools/src/main/resources/logback.xml b/test-tools/src/main/resources/logback.xml new file mode 100644 index 0000000000..06dd0c3a22 --- /dev/null +++ b/test-tools/src/main/resources/logback.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.FileAppender"> + <file>target/test.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + </appender> + + <appender name="TASKS" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>targettasks.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>targettasks-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <root level="error"> + <appender-ref ref="FILE"/> + </root> +</configuration> + diff --git a/tools/atlas-index-repair/src/main/resources/atlas-logback.xml b/tools/atlas-index-repair/src/main/resources/atlas-logback.xml new file mode 100644 index 0000000000..5dc3af8fd8 --- /dev/null +++ b/tools/atlas-index-repair/src/main/resources/atlas-logback.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>/var/log/atlas/atlas-index-janus-repair.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>/var/log/atlas/atlas-index-janus-repair-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas.tools.RepairIndex" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/tools/atlas-index-repair/src/main/resources/repair_index.py b/tools/atlas-index-repair/src/main/resources/repair_index.py index 0333dadca7..fb2bcc35ae 100755 --- a/tools/atlas-index-repair/src/main/resources/repair_index.py +++ b/tools/atlas-index-repair/src/main/resources/repair_index.py @@ -28,7 +28,7 @@ ATLAS_COMMAND_OPTS="-Datlas.home=%s" ATLAS_CONFIG_OPTS="-Datlas.conf=%s" DEFAULT_JVM_HEAP_OPTS="-Xmx4096m -XX:MaxPermSize=512m" -DEFAULT_JVM_OPTS="-Dlog4j.configuration=atlas-log4j.xml -Djava.net.preferIPv4Stack=true -server" +DEFAULT_JVM_OPTS="-Dlogback.configurationFile=atlas-logback.xml -Djava.net.preferIPv4Stack=true -server" def main(): atlas_home = mc.atlasDir() diff --git a/tools/atlas-migration-exporter/atlas-log4j.xml b/tools/atlas-migration-exporter/atlas-log4j.xml deleted file mode 100755 index ae0d27ded8..0000000000 --- a/tools/atlas-migration-exporter/atlas-log4j.xml +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - <appender name="console" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> - <param name="File" value="${atlas.log.dir}/${atlas.log.file}"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p - [%t:%x] ~ %m (%C{1}:%L)%n"/> - </layout> - </appender> - - <logger name="org.apache.atlas" additivity="false"> - <level value="info"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="com.thinkaurelius.titan" additivity="false"> - <level value="warn"/> - <appender-ref ref="FILE"/> - </logger> - - <logger name="org.springframework" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="org.eclipse" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <logger name="com.sun.jersey" additivity="false"> - <level value="warn"/> - <appender-ref ref="console"/> - </logger> - - <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> - <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false"> - <level value="error"/> - <appender-ref ref="FILE"/> - </logger> - - <root> - <priority value="warn"/> - <appender-ref ref="FILE"/> - </root> -</log4j:configuration> diff --git a/tools/atlas-migration-exporter/atlas-logback.xml b/tools/atlas-migration-exporter/atlas-logback.xml new file mode 100755 index 0000000000..2c76b46f8e --- /dev/null +++ b/tools/atlas-migration-exporter/atlas-logback.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="com.thinkaurelius.titan" additivity="false" level="warn"> + <appender-ref ref="FILE"/> + </logger> + + <logger name="org.springframework" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="org.eclipse" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <logger name="com.sun.jersey" additivity="false" level="warn"> + <appender-ref ref="console"/> + </logger> + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="FILE"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/tools/atlas-migration-exporter/atlas_migration_export.py b/tools/atlas-migration-exporter/atlas_migration_export.py index e1b12f6092..31391a7dcc 100755 --- a/tools/atlas-migration-exporter/atlas_migration_export.py +++ b/tools/atlas-migration-exporter/atlas_migration_export.py @@ -27,7 +27,7 @@ ATLAS_COMMAND_OPTS="-Datlas.home=%s" ATLAS_CONFIG_OPTS="-Datlas.conf=%s" DEFAULT_JVM_HEAP_OPTS="-Xmx4096m -XX:MaxPermSize=512m" -DEFAULT_JVM_OPTS="-Dlog4j.configuration=atlas-log4j.xml -Djava.net.preferIPv4Stack=true -server" +DEFAULT_JVM_OPTS="-Dlogback.configurationFile=atlas-logback.xml -Djava.net.preferIPv4Stack=true -server" def main(): is_setup = (len(sys.argv)>1) and sys.argv[1] is not None and sys.argv[1] == '-setup' diff --git a/tools/classification-updater/src/main/resources/atlas-logback.xml b/tools/classification-updater/src/main/resources/atlas-logback.xml new file mode 100644 index 0000000000..f392343ee2 --- /dev/null +++ b/tools/classification-updater/src/main/resources/atlas-logback.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>/var/log/atlas/classification-updater.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>/var/log/atlas/classification-updater-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <logger name="org.apache.atlas.tools.BulkFetchAndUpdate" additivity="false" level="info"> + <appender-ref ref="FILE"/> + </logger> + + <root level="warn"> + <appender-ref ref="FILE"/> + </root> +</configuration> diff --git a/tools/notification-analyzer/pom.xml b/tools/notification-analyzer/pom.xml new file mode 100644 index 0000000000..cfce6c8d92 --- /dev/null +++ b/tools/notification-analyzer/pom.xml @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>apache-atlas</artifactId> + <groupId>org.apache.atlas</groupId> + <version>3.0.0-SNAPSHOT</version> + <relativePath>../../</relativePath> + </parent> + <artifactId>atlas-notification-analyzer</artifactId> + <description>Apache Atlas Notification Analyzer</description> + <name>Apache Atlas Notification Analyzer</name> + <packaging>jar</packaging> + + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${slf4j.version}</version> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>${slf4j.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.atlas</groupId> + <artifactId>atlas-notification</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>commons-cli</groupId> + <artifactId>commons-cli</artifactId> + <version>${commons-cli.version}</version> + </dependency> + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>${commons-collections.version}</version> + </dependency> + </dependencies> + + <profiles> + <profile> + <id>dist</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-binaries</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/dependency</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>false</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>atlas-intg</artifactId> + <version>${project.version}</version> + </artifactItem> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>atlas-notification</artifactId> + <version>${project.version}</version> + </artifactItem> + <artifactItem> + <groupId>commons-cli</groupId> + <artifactId>commons-cli</artifactId> + <version>${commons-cli.version}</version> + </artifactItem> + <artifactItem> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>${commons-codec.version}</version> + </artifactItem> + <artifactItem> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>${commons-collections.version}</version> + </artifactItem> + <artifactItem> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>${commons-io.version}</version> + </artifactItem> + <artifactItem> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </artifactItem> + <artifactItem> + <groupId>org.apache.commons</groupId> + <artifactId>commons-compress</artifactId> + <version>1.26.2</version> + </artifactItem> + <artifactItem> + <groupId>commons-configuration</groupId> + <artifactId>commons-configuration</artifactId> + <version>${commons-conf.version}</version> + </artifactItem> + <artifactItem> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>${commons-lang.version}</version> + </artifactItem> + <artifactItem> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>${commons-logging.version}</version> + </artifactItem> + <artifactItem> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>${jackson.version}</version> + </artifactItem> + <artifactItem> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>${jackson.version}</version> + </artifactItem> + <artifactItem> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson.databind.version}</version> + </artifactItem> + <artifactItem> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logback.version}</version> + </artifactItem> + <artifactItem> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${slf4j.version}</version> + </artifactItem> + <artifactItem> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>${slf4j.version}</version> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> diff --git a/webapp/pom.xml b/webapp/pom.xml index 05a97f200a..74904857eb 100755 --- a/webapp/pom.xml +++ b/webapp/pom.xml @@ -33,7 +33,7 @@ <properties> <debug.jetty.daemon>true</debug.jetty.daemon> - <log4j.configuration.url>file:///${project.build.directory}/../../distro/src/conf/atlas-log4j.xml</log4j.configuration.url> + <logback.configurationFile>file:///${project.build.directory}/../../distro/src/conf/atlas-logback.xml</logback.configurationFile> <projectBaseDir>${project.basedir}/..</projectBaseDir> </properties> @@ -76,7 +76,7 @@ </os> </activation> <properties> - <log4j.configuration.url>file:/${project.build.directory}/../../distro/src/conf/atlas-log4j.xml</log4j.configuration.url> + <logback.configurationFile>file:/${project.build.directory}/../../distro/src/conf/atlas-logback.xml</logback.configurationFile> </properties> </profile> @@ -556,22 +556,19 @@ </dependency> <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>${log4j2.version}</version> + <groupId>org.slf4j</groupId> + <artifactId>log4j-over-slf4j</artifactId> </dependency> <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-web</artifactId> - <version>${log4j2.version}</version> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - <version>${log4j2.version}</version> - </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> @@ -796,8 +793,8 @@ <value>application.log</value> </systemProperty> <systemProperty> - <name>log4j.configuration</name> - <value>${log4j.configuration.url}</value> + <name>logback.configurationFile</name> + <value>${logback.configurationFile}</value> </systemProperty> <systemProperty> <name>atlas.graphdb.backend</name> From fa736fe0e2f9acc94bca20180cead489be5314a5 Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Tue, 24 Dec 2024 11:57:36 +0530 Subject: [PATCH 02/23] use log4j after logback --- .../{atlas-log4j2.xml => atlas-log4j222.xml} | 0 pom.xml | 13 +++++++------ webapp/pom.xml | 15 +++++---------- 3 files changed, 12 insertions(+), 16 deletions(-) rename atlas-hub/pre-conf/{atlas-log4j2.xml => atlas-log4j222.xml} (100%) diff --git a/atlas-hub/pre-conf/atlas-log4j2.xml b/atlas-hub/pre-conf/atlas-log4j222.xml similarity index 100% rename from atlas-hub/pre-conf/atlas-log4j2.xml rename to atlas-hub/pre-conf/atlas-log4j222.xml diff --git a/pom.xml b/pom.xml index 77214c65db..cba8770e94 100644 --- a/pom.xml +++ b/pom.xml @@ -991,12 +991,6 @@ <version>${jaxb.api.version}</version> </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>log4j-over-slf4j</artifactId> - <version>${slf4j.version}</version> - </dependency> - <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> @@ -1009,6 +1003,13 @@ <version>${logback.version}</version> </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>log4j-over-slf4j</artifactId> + <version>${slf4j.version}</version> + </dependency> + + <!-- hadoop --> <dependency> <groupId>org.apache.hadoop</groupId> diff --git a/webapp/pom.xml b/webapp/pom.xml index 74904857eb..3ae780e814 100755 --- a/webapp/pom.xml +++ b/webapp/pom.xml @@ -543,11 +543,6 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>ch.qos.reload4j</groupId> - <artifactId>reload4j</artifactId> - <version>${reload4j.version}</version> - </dependency> <dependency> <groupId>org.apache.atlas</groupId> <artifactId>atlas-testtools</artifactId> @@ -555,11 +550,6 @@ <scope>test</scope> </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>log4j-over-slf4j</artifactId> - </dependency> - <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> @@ -570,6 +560,11 @@ <artifactId>logback-core</artifactId> </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>log4j-over-slf4j</artifactId> + </dependency> + <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> From 7fabb7fd92f07911368e64a3b4b661730e0c7eb8 Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Tue, 24 Dec 2024 12:11:24 +0530 Subject: [PATCH 03/23] remove --- .../src/main/java/org/apache/atlas/hook/AtlasHook.java | 4 ++-- .../java/org/apache/atlas/kafka/NotificationProvider.java | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java index 980db4812f..c0bda530d7 100644 --- a/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java +++ b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java @@ -95,8 +95,8 @@ public abstract class AtlasHook { failedMessagesLogger = null; } - isRESTNotificationEnabled = AtlasConfiguration.NOTIFICATION_HOOK_REST_ENABLED.getBoolean(); - isHookMsgsSortEnabled = atlasProperties.getBoolean(CONF_ATLAS_HOOK_MESSAGES_SORT_ENABLED, isRESTNotificationEnabled); +// isRESTNotificationEnabled = AtlasConfiguration.NOTIFICATION_HOOK_REST_ENABLED.getBoolean(); +// isHookMsgsSortEnabled = atlasProperties.getBoolean(CONF_ATLAS_HOOK_MESSAGES_SORT_ENABLED, isRESTNotificationEnabled); metadataNamespace = getMetadataNamespace(atlasProperties); notificationMaxRetries = atlasProperties.getInt(ATLAS_NOTIFICATION_MAX_RETRIES, 3); notificationRetryInterval = atlasProperties.getInt(ATLAS_NOTIFICATION_RETRY_INTERVAL, 1000); diff --git a/notification/src/main/java/org/apache/atlas/kafka/NotificationProvider.java b/notification/src/main/java/org/apache/atlas/kafka/NotificationProvider.java index b35af97fd1..0772260cd9 100644 --- a/notification/src/main/java/org/apache/atlas/kafka/NotificationProvider.java +++ b/notification/src/main/java/org/apache/atlas/kafka/NotificationProvider.java @@ -19,7 +19,6 @@ import org.apache.atlas.ApplicationProperties; import org.apache.atlas.AtlasException; -import org.apache.atlas.notification.LogConfigUtils; import org.apache.atlas.notification.NotificationInterface; import org.apache.atlas.notification.spool.AtlasFileSpool; import org.apache.commons.configuration.Configuration; From 873adc11aae9a6f2f36bfe7a1a2e2705fd9afd20 Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Thu, 26 Dec 2024 15:59:51 +0530 Subject: [PATCH 04/23] OTEL integration after log back --- webapp/pom.xml | 25 +++++++++++ .../src/main/java/org/apache/atlas/Atlas.java | 44 ++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/webapp/pom.xml b/webapp/pom.xml index 3ae780e814..5e9d70c939 100755 --- a/webapp/pom.xml +++ b/webapp/pom.xml @@ -583,6 +583,31 @@ <version>1.17.0</version> </dependency> + <!-- OTEL integration in webapp/pom.xml --> + <dependency> + <groupId>io.opentelemetry</groupId> + <artifactId>opentelemetry-sdk</artifactId> + <version>1.42.0</version> + </dependency> + <dependency> + <groupId>io.opentelemetry</groupId> + <artifactId>opentelemetry-exporter-otlp</artifactId> + <version>1.42.0</version> + </dependency> + + <dependency> + <groupId>io.opentelemetry.semconv</groupId> + <artifactId>opentelemetry-semconv</artifactId> + <version>1.27.0-alpha</version> + </dependency> + + <dependency> + <groupId>io.opentelemetry.instrumentation</groupId> + <artifactId>opentelemetry-logback-appender-1.0</artifactId> + <version>2.10.0-alpha</version> + </dependency> + + </dependencies> <build> diff --git a/webapp/src/main/java/org/apache/atlas/Atlas.java b/webapp/src/main/java/org/apache/atlas/Atlas.java index 548ef6e4e7..3b22a60ab3 100755 --- a/webapp/src/main/java/org/apache/atlas/Atlas.java +++ b/webapp/src/main/java/org/apache/atlas/Atlas.java @@ -18,6 +18,15 @@ package org.apache.atlas; +import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogRecordExporter; +import io.opentelemetry.sdk.OpenTelemetrySdk; +import io.opentelemetry.sdk.logs.SdkLoggerProvider; +import io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor; +import io.opentelemetry.sdk.resources.Resource; +import io.opentelemetry.sdk.trace.SdkTracerProvider; +import io.opentelemetry.sdk.trace.samplers.Sampler; +import io.opentelemetry.semconv.ResourceAttributes; import org.apache.atlas.repository.graphdb.janus.AtlasElasticsearchDatabase; import org.apache.atlas.security.SecurityProperties; import org.apache.atlas.util.AccessAuditLogsIndexCreator; @@ -48,7 +57,8 @@ import java.net.SocketException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.util.*; +import java.util.Arrays; +import java.util.Iterator; import static org.apache.atlas.repository.Constants.INDEX_PREFIX; import static org.apache.atlas.repository.Constants.VERTEX_INDEX; @@ -112,6 +122,13 @@ protected static CommandLine parseArgs(String[] args) throws ParseException { } public static void main(String[] args) throws Exception { + + // Initialize OpenTelemetry as early as possible + OpenTelemetry openTelemetry = initializeOpenTelemetry(); + // Install OpenTelemetry in logback appender + io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender.install( + openTelemetry); + CommandLine cmd = parseArgs(args); PropertiesConfiguration buildConfiguration = new PropertiesConfiguration("atlas-buildinfo.properties"); String appPath = "webapp/target/atlas-webapp-" + getProjectVersion(buildConfiguration); @@ -166,6 +183,31 @@ private static void setApplicationHome() { } } + private static OpenTelemetry initializeOpenTelemetry() { + OpenTelemetrySdk sdk = + OpenTelemetrySdk.builder() + .setTracerProvider(SdkTracerProvider.builder().setSampler(Sampler.alwaysOn()).build()) + .setLoggerProvider( + SdkLoggerProvider.builder() + .setResource( + Resource.getDefault().toBuilder() + .put(ResourceAttributes.SERVICE_NAME, "atlas") + .build()) + .addLogRecordProcessor( + BatchLogRecordProcessor.builder( + OtlpGrpcLogRecordExporter.builder() + .setEndpoint("http://localhost:4317") + .build()) + .build()) + .build()) + .build(); + + // Add hook to close SDK, which flushes logs + Runtime.getRuntime().addShutdownHook(new Thread(sdk::close)); + + return sdk; + } + public static String getProjectVersion(PropertiesConfiguration buildConfiguration) { return buildConfiguration.getString("project.version"); } From a6a87f00beccc771fd9b2fd2d54d63a3bc9e218f Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Tue, 31 Dec 2024 15:20:40 +0530 Subject: [PATCH 05/23] Capture audit configurations as attributes --- .../java/org/apache/atlas/web/filters/AuditFilter.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java index 1f6776592e..c2f8a1999b 100755 --- a/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java +++ b/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java @@ -157,7 +157,15 @@ private void recordAudit(HttpServletRequest httpRequest, Date when, String who, public static void audit(AuditLog auditLog) { if (AUDIT_LOG.isInfoEnabled() && auditLog != null) { - AUDIT_LOG.info(auditLog.toString()); + MDC.put("requestTime", DateTimeHelper.formatDateUTC(auditLog.requestTime)); + MDC.put("user", auditLog.userName); + MDC.put("from", auditLog.fromAddress); + MDC.put("requestMethod", auditLog.requestMethod); + MDC.put("requestUrl", auditLog.requestUrl); + MDC.put("httpStatus", String.valueOf(auditLog.httpStatus)); + MDC.put("timeTaken", String.valueOf(auditLog.timeTaken)); + AUDIT_LOG.info("Capturing audit log"); + MDC.clear(); } } From 5b383f0b1543cf2f922688227f600a74ddabc6de Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Thu, 2 Jan 2025 13:05:55 +0530 Subject: [PATCH 06/23] remove clear --- .../src/main/java/org/apache/atlas/web/filters/AuditFilter.java | 1 - 1 file changed, 1 deletion(-) diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java index c2f8a1999b..48c9db5960 100755 --- a/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java +++ b/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java @@ -165,7 +165,6 @@ public static void audit(AuditLog auditLog) { MDC.put("httpStatus", String.valueOf(auditLog.httpStatus)); MDC.put("timeTaken", String.valueOf(auditLog.timeTaken)); AUDIT_LOG.info("Capturing audit log"); - MDC.clear(); } } From 3c1c67231839550346952c9749fc4ce59508fc8c Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Tue, 7 Jan 2025 19:18:59 +0530 Subject: [PATCH 07/23] Add resource attributes --- .../org/apache/atlas/AtlasConfiguration.java | 11 +++- .../src/main/java/org/apache/atlas/Atlas.java | 54 +++++++++++++------ 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java b/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java index b83e1e4f8f..47875ad0e7 100644 --- a/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java +++ b/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java @@ -119,10 +119,17 @@ public enum AtlasConfiguration { ATLAS_INDEXSEARCH_ENABLE_API_LIMIT("atlas.indexsearch.enable.api.limit", false), ATLAS_INDEXSEARCH_ENABLE_JANUS_OPTIMISATION("atlas.indexsearch.enable.janus.optimization", false), ATLAS_MAINTENANCE_MODE("atlas.maintenance.mode", false), - DELTA_BASED_REFRESH_ENABLED("atlas.authorizer.enable.delta_based_refresh", false), - ATLAS_UD_RELATIONSHIPS_MAX_COUNT("atlas.ud.relationship.max.count", 100); + ATLAS_UD_RELATIONSHIPS_MAX_COUNT("atlas.ud.relationship.max.count", 100), + + /*** + * OTEL Configuration + */ + OTEL_RESOURCE_ATTRIBUTES("OTEL_RESOURCE_ATTRIBUTES", "service.name=atlas"), + OTEL_SERVICE_NAME(" OTEL_SERVICE_NAME", "atlas"), + OTEL_EXPORTER_OTLP_ENDPOINT("OTEL_EXPORTER_OTLP_ENDPOINT", "http://localhost:4317"); + private static final Configuration APPLICATION_PROPERTIES; diff --git a/webapp/src/main/java/org/apache/atlas/Atlas.java b/webapp/src/main/java/org/apache/atlas/Atlas.java index 3b22a60ab3..ede4172468 100755 --- a/webapp/src/main/java/org/apache/atlas/Atlas.java +++ b/webapp/src/main/java/org/apache/atlas/Atlas.java @@ -24,6 +24,7 @@ import io.opentelemetry.sdk.logs.SdkLoggerProvider; import io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor; import io.opentelemetry.sdk.resources.Resource; +import io.opentelemetry.sdk.resources.ResourceBuilder; import io.opentelemetry.sdk.trace.SdkTracerProvider; import io.opentelemetry.sdk.trace.samplers.Sampler; import io.opentelemetry.semconv.ResourceAttributes; @@ -59,6 +60,7 @@ import java.nio.file.Files; import java.util.Arrays; import java.util.Iterator; +import java.util.List; import static org.apache.atlas.repository.Constants.INDEX_PREFIX; import static org.apache.atlas.repository.Constants.VERTEX_INDEX; @@ -184,23 +186,41 @@ private static void setApplicationHome() { } private static OpenTelemetry initializeOpenTelemetry() { - OpenTelemetrySdk sdk = - OpenTelemetrySdk.builder() - .setTracerProvider(SdkTracerProvider.builder().setSampler(Sampler.alwaysOn()).build()) - .setLoggerProvider( - SdkLoggerProvider.builder() - .setResource( - Resource.getDefault().toBuilder() - .put(ResourceAttributes.SERVICE_NAME, "atlas") - .build()) - .addLogRecordProcessor( - BatchLogRecordProcessor.builder( - OtlpGrpcLogRecordExporter.builder() - .setEndpoint("http://localhost:4317") - .build()) - .build()) - .build()) - .build(); + + List<String> customResourceAttr = + Arrays.asList(AtlasConfiguration.OTEL_RESOURCE_ATTRIBUTES.getStringArray()); + + ResourceBuilder resourceBuilder = Resource.getDefault().toBuilder() + .put(ResourceAttributes.SERVICE_NAME, AtlasConfiguration.OTEL_SERVICE_NAME.getString()); + + // Iterate through the ArrayList and add each attribute + for (String attribute : customResourceAttr) { + String[] keyValue = attribute.split("="); + if (keyValue.length == 2) { + String key = keyValue[0].trim(); + String value = keyValue[1].trim(); + resourceBuilder.put(key, value); + } + } + + OpenTelemetrySdk sdk = OpenTelemetrySdk.builder() + .setTracerProvider(SdkTracerProvider.builder() + .setSampler(Sampler.alwaysOn()) + .build()) + .setLoggerProvider( + SdkLoggerProvider.builder() + .setResource(resourceBuilder.build()) + .addLogRecordProcessor( + BatchLogRecordProcessor.builder( + OtlpGrpcLogRecordExporter.builder() + .setEndpoint(AtlasConfiguration.OTEL_EXPORTER_OTLP_ENDPOINT.getString()) + .build() + ) + .build() + ) + .build() + ) + .build(); // Add hook to close SDK, which flushes logs Runtime.getRuntime().addShutdownHook(new Thread(sdk::close)); From cd6b75cbac9461ea3d18e42ae20463aef1b694cc Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Thu, 9 Jan 2025 14:06:43 +0530 Subject: [PATCH 08/23] fix filename --- Dockerfile | 3 +- atlas-hub/pre-conf/atlas-log4j222.xml | 13 -- atlas-hub/pre-conf/atlas-logback.xml | 202 ++++++++++++++++++++++++++ 3 files changed, 203 insertions(+), 15 deletions(-) delete mode 100644 atlas-hub/pre-conf/atlas-log4j222.xml create mode 100644 atlas-hub/pre-conf/atlas-logback.xml diff --git a/Dockerfile b/Dockerfile index ec34b5d22b..fa65acca4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,8 +56,7 @@ COPY atlas-hub/repair_index.py /opt/apache-atlas/bin/ RUN chmod +x /opt/apache-atlas/bin/repair_index.py COPY atlas-hub/atlas_start.py.patch atlas-hub/atlas_config.py.patch /opt/apache-atlas/bin/ -COPY atlas-hub/pre-conf/atlas-log4j.xml /opt/apache-atlas/conf/ -COPY atlas-hub/pre-conf/atlas-log4j2.xml /opt/apache-atlas/conf/ +COPY atlas-hub/pre-conf/atlas-logback.xml /opt/apache-atlas/conf/ COPY atlas-hub/pre-conf/atlas-auth/ /opt/apache-atlas/conf/ RUN curl https://repo1.maven.org/maven2/org/jolokia/jolokia-jvm/1.6.2/jolokia-jvm-1.6.2-agent.jar -o /opt/apache-atlas/libext/jolokia-jvm-agent.jar diff --git a/atlas-hub/pre-conf/atlas-log4j222.xml b/atlas-hub/pre-conf/atlas-log4j222.xml deleted file mode 100644 index 5dc63878c9..0000000000 --- a/atlas-hub/pre-conf/atlas-log4j222.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Configuration status="WARN"> - <Appenders> - <Console name="Console" target="SYSTEM_OUT"> - <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> - </Console> - </Appenders> - <Loggers> - <Root level="error"> - <AppenderRef ref="Console"/> - </Root> - </Loggers> -</Configuration> \ No newline at end of file diff --git a/atlas-hub/pre-conf/atlas-logback.xml b/atlas-hub/pre-conf/atlas-logback.xml new file mode 100644 index 0000000000..61e0637d10 --- /dev/null +++ b/atlas-hub/pre-conf/atlas-logback.xml @@ -0,0 +1,202 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you 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. + --> + +<configuration> + <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <encoder> + <pattern> + logback: %d %-5p - [%t:%X{context-key}] - X-Atlan-Request-Id:[%X{X-Atlan-Request-Id}] - traceId:[%X{trace_id}] - span_id:[%X{span_id}] ~ %m (%C{1}:%L)%n + </pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + </appender> + + <appender name="OpenTelemetry" + class="io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender"> + <!-- Additional capture options --> + <captureExperimentalAttributes>true</captureExperimentalAttributes> + <captureMdcAttributes>*</captureMdcAttributes> + <captureLoggerContext>true</captureLoggerContext> + <captureKeyValuePairAttributes>true</captureKeyValuePairAttributes> + </appender> + + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/${atlas.log.file}</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>true</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="LARGE_MESSAGES" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/large_messages.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/large_messages-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/audit.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/audit-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="TASKS" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/tasks.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/tasks-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/metrics.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/metrics-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <appender name="FAILED" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/failed.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/failed-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + + <!-- Uncomment the following for perf logs --> + <!-- + <appender name="perf_appender" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${atlas.log.dir}/atlas_perf.log</file> + <append>true</append> + <encoder> + <pattern>%date [%thread] %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${atlas.log.dir}/atlas_perf-%d.log</fileNamePattern> + <maxHistory>20</maxHistory> + <cleanHistoryOnStart>false</cleanHistoryOnStart> + </rollingPolicy> + </appender> + --> + <logger name="perf_appender" additivity="false" level="debug"> + <appender-ref ref="console"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + + <logger name="org.apache.atlas" additivity="false" level="info"> + <appender-ref ref="console"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + <logger name="org.janusgraph" additivity="false" level="warn"> + <appender-ref ref="console"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + <logger name="org.springframework" additivity="false" level="warn"> + <appender-ref ref="console"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + <logger name="org.eclipse" additivity="false" level="warn"> + <appender-ref ref="console"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + <logger name="com.sun.jersey" additivity="false" level="warn"> + <appender-ref ref="console"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + <!-- to avoid logs - The configuration log.flush.interval.messages = 1 was supplied but isn't a known config --> + <logger name="org.apache.kafka.common.config.AbstractConfig" additivity="false" level="error"> + <appender-ref ref="console"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + <logger name="AUDIT" additivity="false" level="info"> + <appender-ref ref="console"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + <logger name="LARGE_MESSAGES" additivity="false" level="warn"> + <appender-ref ref="console"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + <logger name="METRICS" additivity="false" level="debug"> + <appender-ref ref="console"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + <logger name="FAILED" additivity="false" level="info"> + <appender-ref ref="console"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + <logger name="TASKS" additivity="false" level="info"> + <appender-ref ref="console"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + <root level="INFO"> + <appender-ref ref="OpenTelemetry"/> + <appender-ref ref="console"/> + </root> +</configuration> \ No newline at end of file From fc5d98a3a3d7ec2fe79f64dac55ba241b4c1bfa0 Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Thu, 9 Jan 2025 14:50:06 +0530 Subject: [PATCH 09/23] add mdc filter --- .../apache/atlas/web/filters/MDCFilter.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 webapp/src/main/java/org/apache/atlas/web/filters/MDCFilter.java diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/MDCFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/MDCFilter.java new file mode 100644 index 0000000000..885848d9b9 --- /dev/null +++ b/webapp/src/main/java/org/apache/atlas/web/filters/MDCFilter.java @@ -0,0 +1,30 @@ +package org.apache.atlas.web.filters;import ch.qos.logback.classic.spi.ILoggingEvent; + + +import ch.qos.logback.core.filter.Filter; +import ch.qos.logback.core.spi.FilterReply; +import org.slf4j.MDC; + +public class MDCFilter extends Filter<ILoggingEvent> { + + private String mdcKey; + private String mdcValue; + + public void setMdcKey(String mdcKey) { + this.mdcKey = mdcKey; + } + + public void setMdcValue(String mdcValue) { + this.mdcValue = mdcValue; + } + + @Override + public FilterReply decide(ILoggingEvent event) { + // Check if the MDC key-value matches + String value = MDC.get(mdcKey); + if (value != null && value.equals(mdcValue)) { + return FilterReply.ACCEPT; + } + return FilterReply.DENY; + } +} From bbd59a39199d5bc6462eb4dc0f69a8c3ec8bbb8c Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Thu, 9 Jan 2025 16:12:43 +0530 Subject: [PATCH 10/23] add MDC filter for logging --- .../java/org/apache/atlas/web/filters/MDCFilter.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/MDCFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/MDCFilter.java index 885848d9b9..b3913be80a 100644 --- a/webapp/src/main/java/org/apache/atlas/web/filters/MDCFilter.java +++ b/webapp/src/main/java/org/apache/atlas/web/filters/MDCFilter.java @@ -1,4 +1,5 @@ -package org.apache.atlas.web.filters;import ch.qos.logback.classic.spi.ILoggingEvent; +package org.apache.atlas.web.filters; +import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.filter.Filter; @@ -20,11 +21,7 @@ public void setMdcValue(String mdcValue) { @Override public FilterReply decide(ILoggingEvent event) { - // Check if the MDC key-value matches - String value = MDC.get(mdcKey); - if (value != null && value.equals(mdcValue)) { - return FilterReply.ACCEPT; - } - return FilterReply.DENY; + MDC.put(mdcKey, mdcValue); + return FilterReply.ACCEPT; } } From d18996089f51ae09d0641a57b7866c6f051ffe56 Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Thu, 9 Jan 2025 16:37:12 +0530 Subject: [PATCH 11/23] update logback file --- atlas-hub/pre-conf/atlas-logback.xml | 187 ++++++++++++++++----------- 1 file changed, 111 insertions(+), 76 deletions(-) diff --git a/atlas-hub/pre-conf/atlas-logback.xml b/atlas-hub/pre-conf/atlas-logback.xml index 61e0637d10..3a7b709e28 100644 --- a/atlas-hub/pre-conf/atlas-logback.xml +++ b/atlas-hub/pre-conf/atlas-logback.xml @@ -22,7 +22,7 @@ <param name="Target" value="System.out"/> <encoder> <pattern> - logback: %d %-5p - [%t:%X{context-key}] - X-Atlan-Request-Id:[%X{X-Atlan-Request-Id}] - traceId:[%X{trace_id}] - span_id:[%X{span_id}] ~ %m (%C{1}:%L)%n + logback: %d %-5p - [%t:%X{context-key}] - traceId:[%X{trace_id}] ~ %m (%C{1}:%L)%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> @@ -39,108 +39,143 @@ <captureKeyValuePairAttributes>true</captureKeyValuePairAttributes> </appender> - - <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${atlas.log.dir}/${atlas.log.file}</file> - <append>true</append> + <appender name="consoleAudit" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <filter class="org.apache.atlas.web.filters.MDCFilter"> + <mdcKey>filter</mdcKey> + <mdcValue>atlas-audit</mdcValue> + </filter> <encoder> - <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + <pattern> + logback: %d %-5p - [%t:%X{context-key}] - X-Atlan-Request-Id:[%X{X-Atlan-Request-Id}] - traceId:[%X{trace_id}] ~ %m (%C{1}:%L)%n + </pattern> </encoder> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> - <maxHistory>20</maxHistory> - <cleanHistoryOnStart>true</cleanHistoryOnStart> - </rollingPolicy> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> </appender> - <appender name="LARGE_MESSAGES" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${atlas.log.dir}/large_messages.log</file> - <append>true</append> + <appender name="consoleAuthAudit" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <filter class="org.apache.atlas.web.filters.MDCFilter"> + <mdcKey>filter</mdcKey> + <mdcValue>atlas-auth-audit</mdcValue> + </filter> <encoder> - <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + <pattern> + logback: %d %-5p - [%t:%X{context-key}] - X-Atlan-Request-Id:[%X{X-Atlan-Request-Id}] - traceId:[%X{trace_id}] ~ %m (%C{1}:%L)%n + </pattern> </encoder> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${atlas.log.dir}/large_messages-%d.log</fileNamePattern> - <maxHistory>20</maxHistory> - <cleanHistoryOnStart>false</cleanHistoryOnStart> - </rollingPolicy> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> </appender> - <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${atlas.log.dir}/audit.log</file> - <append>true</append> + <appender name="consoleAtlas" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <filter class="org.apache.atlas.web.filters.MDCFilter"> + <mdcKey>filter</mdcKey> + <mdcValue>atlas-application</mdcValue> + </filter> <encoder> - <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + <pattern> + logback: %d %-5p - [%t:%X{context-key}] - X-Atlan-Request-Id:[%X{X-Atlan-Request-Id}] - traceId:[%X{trace_id}] ~ %m (%C{1}:%L)%n + </pattern> </encoder> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${atlas.log.dir}/audit-%d.log</fileNamePattern> - <maxHistory>20</maxHistory> - <cleanHistoryOnStart>false</cleanHistoryOnStart> - </rollingPolicy> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> </appender> - <appender name="TASKS" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${atlas.log.dir}/tasks.log</file> - <append>true</append> + <appender name="consolePerf" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <filter class="org.apache.atlas.web.filters.MDCFilter"> + <mdcKey>filter</mdcKey> + <mdcValue>atlas-perf</mdcValue> + </filter> <encoder> - <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + <pattern> + logback: %d %-5p - [%t:%X{context-key}] - X-Atlan-Request-Id:[%X{X-Atlan-Request-Id}] - traceId:[%X{trace_id}] ~ %m (%C{1}:%L)%n + </pattern> </encoder> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${atlas.log.dir}/tasks-%d.log</fileNamePattern> - <maxHistory>20</maxHistory> - <cleanHistoryOnStart>false</cleanHistoryOnStart> - </rollingPolicy> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> </appender> - <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${atlas.log.dir}/metrics.log</file> - <append>true</append> + <appender name="consoleRanger" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <filter class="org.apache.atlas.web.filters.MDCFilter"> + <mdcKey>filter</mdcKey> + <mdcValue>atlas-ranger</mdcValue> + </filter> <encoder> - <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + <pattern> + logback: %d %-5p - [%t:%X{context-key}] - X-Atlan-Request-Id:[%X{X-Atlan-Request-Id}] - traceId:[%X{trace_id}] ~ %m (%C{1}:%L)%n + </pattern> </encoder> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${atlas.log.dir}/metrics-%d.log</fileNamePattern> - <maxHistory>20</maxHistory> - <cleanHistoryOnStart>false</cleanHistoryOnStart> - </rollingPolicy> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> </appender> - <appender name="FAILED" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${atlas.log.dir}/failed.log</file> - <append>true</append> + <appender name="consoleMetrics" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <filter class="org.apache.atlas.web.filters.MDCFilter"> + <mdcKey>filter</mdcKey> + <mdcValue>atlas-metrics</mdcValue> + </filter> <encoder> - <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> + <pattern> + logback: %d %-5p - [%t:%X{context-key}] - X-Atlan-Request-Id:[%X{X-Atlan-Request-Id}] - traceId:[%X{trace_id}] ~ %m (%C{1}:%L)%n + </pattern> </encoder> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${atlas.log.dir}/failed-%d.log</fileNamePattern> - <maxHistory>20</maxHistory> - <cleanHistoryOnStart>false</cleanHistoryOnStart> - </rollingPolicy> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> </appender> - <!-- Uncomment the following for perf logs --> - <!-- - <appender name="perf_appender" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${atlas.log.dir}/atlas_perf.log</file> - <append>true</append> - <encoder> - <pattern>%date [%thread] %msg%n</pattern> - </encoder> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${atlas.log.dir}/atlas_perf-%d.log</fileNamePattern> - <maxHistory>20</maxHistory> - <cleanHistoryOnStart>false</cleanHistoryOnStart> - </rollingPolicy> + <appender name="consoleTasks" class="ch.qos.logback.core.ConsoleAppender"> + <param name="Target" value="System.out"/> + <filter class="org.apache.atlas.web.filters.MDCFilter"> + <mdcKey>filter</mdcKey> + <mdcValue>atlas-tasks</mdcValue> + </filter> + <encoder> + <pattern> + logback: %d %-5p - [%t:%X{context-key}] - X-Atlan-Request-Id:[%X{X-Atlan-Request-Id}] - traceId:[%X{trace_id}] ~ %m (%C{1}:%L)%n + </pattern> + </encoder> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> </appender> - --> - <logger name="perf_appender" additivity="false" level="debug"> - <appender-ref ref="console"/> + + <logger name="org.apache.atlas.auth.perf" additivity="false" level="OFF"> + <appender-ref ref="console"/> <appender-ref ref="OpenTelemetry"/> </logger> + <logger name="AUTH_AUDIT" additivity="false" level="info"> + <appender-ref ref="consoleAuthAudit"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + <!-- Authz loggers End --> + + <logger name="org.apache.atlas.perf" additivity="false" level="debug"> + <appender-ref ref="consolePerf"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + <logger name="org.apache.atlas" additivity="false" level="info"> - <appender-ref ref="console"/> + <appender-ref ref="consoleAtlas"/> + <appender-ref ref="OpenTelemetry"/> + </logger> + + <logger name="org.apache.ranger" additivity="false" level="warn"> + <appender-ref ref="consoleRanger"/> <appender-ref ref="OpenTelemetry"/> </logger> @@ -171,7 +206,7 @@ </logger> <logger name="AUDIT" additivity="false" level="info"> - <appender-ref ref="console"/> + <appender-ref ref="consoleAudit"/> <appender-ref ref="OpenTelemetry"/> </logger> @@ -181,7 +216,7 @@ </logger> <logger name="METRICS" additivity="false" level="debug"> - <appender-ref ref="console"/> + <appender-ref ref="consoleMetrics"/> <appender-ref ref="OpenTelemetry"/> </logger> @@ -191,7 +226,7 @@ </logger> <logger name="TASKS" additivity="false" level="info"> - <appender-ref ref="console"/> + <appender-ref ref="consoleTasks"/> <appender-ref ref="OpenTelemetry"/> </logger> From a0c08763de4bccb69fae877aa275e3f8893eecf6 Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Fri, 10 Jan 2025 00:18:09 +0530 Subject: [PATCH 12/23] add logback for ranger --- auth-audits/pom.xml | 33 +++++++++++++++++++ .../destination/Log4JAuditDestination.java | 12 +++---- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/auth-audits/pom.xml b/auth-audits/pom.xml index ba0d53f0f8..73bc59827d 100644 --- a/auth-audits/pom.xml +++ b/auth-audits/pom.xml @@ -91,6 +91,39 @@ <artifactId>elasticsearch-rest-high-level-client</artifactId> <version>${elasticsearch.version}</version> </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + </dependency> + + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + </dependency> + + <!-- OTEL integration in pom.xml --> + <dependency> + <groupId>io.opentelemetry</groupId> + <artifactId>opentelemetry-sdk</artifactId> + <version>1.42.0</version> + </dependency> + <dependency> + <groupId>io.opentelemetry</groupId> + <artifactId>opentelemetry-exporter-otlp</artifactId> + <version>1.42.0</version> + </dependency> + + <dependency> + <groupId>io.opentelemetry.semconv</groupId> + <artifactId>opentelemetry-semconv</artifactId> + <version>1.27.0-alpha</version> + </dependency> + + <dependency> + <groupId>io.opentelemetry.instrumentation</groupId> + <artifactId>opentelemetry-logback-appender-1.0</artifactId> + <version>2.10.0-alpha</version> + </dependency> </dependencies> diff --git a/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java b/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java index cb3c80db28..3499e5785d 100644 --- a/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java +++ b/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java @@ -19,19 +19,19 @@ package org.apache.atlas.audit.destination; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.atlas.audit.model.AuditEventBase; import org.apache.atlas.audit.provider.MiscUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Collection; import java.util.Properties; public class Log4JAuditDestination extends AuditDestination { - private static final Log logger = LogFactory - .getLog(Log4JAuditDestination.class); + private static final Logger logger = LoggerFactory + .getLogger(Log4JAuditDestination.class); - private static Log auditLogger = null; + private static Logger auditLogger = null; public static final String PROP_LOG4J_LOGGER = "logger"; public static final String DEFAULT_LOGGER_PREFIX = "ranger.audit"; @@ -54,7 +54,7 @@ public void init(Properties prop, String propPrefix) { + loggerName); } logger.info("Logger name for " + getName() + " is " + loggerName); - auditLogger = LogFactory.getLog(loggerName); + auditLogger = LoggerFactory.getLogger(loggerName); logger.info("Done initializing logger for audit. name=" + getName() + ", loggerName=" + loggerName); } From 197ec5eb028499fbd587d7b905017d5a10b9f82c Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Fri, 10 Jan 2025 00:33:02 +0530 Subject: [PATCH 13/23] record elapsed time as MDC attribute --- .../main/java/org/apache/atlas/utils/AtlasPerfTracer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java b/common/src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java index a2baa65b03..f09681df38 100644 --- a/common/src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java +++ b/common/src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java @@ -19,6 +19,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.slf4j.MDC; /** @@ -74,7 +75,9 @@ public long getElapsedTime() { public void log() { long elapsedTime = getElapsedTime(); if (elapsedTime > reportingThresholdMs) { - logger.debug("PERF|{}|{}", tag, elapsedTime); + MDC.put("elapsedTime", String.valueOf(elapsedTime)); + logger.debug("PERF|{}", tag); + MDC.clear(); } } } From b5486337aa5e1448d36b1ca2707aa72afe54d9b3 Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Mon, 20 Jan 2025 14:06:47 +0530 Subject: [PATCH 14/23] enable log4jaudit destination --- atlas-hub/pre-conf/atlas-auth/atlas-atlas-audit.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atlas-hub/pre-conf/atlas-auth/atlas-atlas-audit.xml b/atlas-hub/pre-conf/atlas-auth/atlas-atlas-audit.xml index 39dbcdc1c3..2b925e8e28 100755 --- a/atlas-hub/pre-conf/atlas-auth/atlas-atlas-audit.xml +++ b/atlas-hub/pre-conf/atlas-auth/atlas-atlas-audit.xml @@ -111,7 +111,7 @@ <!-- Log4j audit provider configuration --> <property> <name>xasecure.audit.destination.log4j</name> - <value>false</value> + <value>true</value> </property> <property> From b5ae633adc8fd39614bc57de77bb356c1eaa045e Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Tue, 21 Jan 2025 16:21:49 +0530 Subject: [PATCH 15/23] remove MDC attribute --- .../src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java b/common/src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java index f09681df38..45bd63cc42 100644 --- a/common/src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java +++ b/common/src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java @@ -75,9 +75,9 @@ public long getElapsedTime() { public void log() { long elapsedTime = getElapsedTime(); if (elapsedTime > reportingThresholdMs) { - MDC.put("elapsedTime", String.valueOf(elapsedTime)); + MDC.put("timeTaken", String.valueOf(elapsedTime)); logger.debug("PERF|{}", tag); - MDC.clear(); + MDC.remove("timeTaken"); } } } From 2f55038ce5828979ba902e200d8377fdac0710e4 Mon Sep 17 00:00:00 2001 From: Suman Das <59254445+sumandas0@users.noreply.github.com> Date: Tue, 21 Jan 2025 23:35:38 +0530 Subject: [PATCH 16/23] fix: change loginterceptor level to basic to only print status log --- .../org/apache/atlas/auth/client/auth/AbstractAuthClient.java | 2 +- .../atlas/auth/client/auth/KeycloakAuthenticationService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client-auth/src/main/java/org/apache/atlas/auth/client/auth/AbstractAuthClient.java b/client-auth/src/main/java/org/apache/atlas/auth/client/auth/AbstractAuthClient.java index cb13431384..43db5b8a27 100644 --- a/client-auth/src/main/java/org/apache/atlas/auth/client/auth/AbstractAuthClient.java +++ b/client-auth/src/main/java/org/apache/atlas/auth/client/auth/AbstractAuthClient.java @@ -56,7 +56,7 @@ public AbstractAuthClient(AuthConfig authConfig) { this.authConfig = authConfig; this.metricUtils = new MetricUtils(); HttpLoggingInterceptor httpInterceptor = new HttpLoggingInterceptor(); - httpInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); + httpInterceptor.setLevel(HttpLoggingInterceptor.Level.BASIC); OkHttpClient okHttpClient = new OkHttpClient.Builder() .addInterceptor(accessTokenInterceptor) .addInterceptor(httpInterceptor) diff --git a/client-auth/src/main/java/org/apache/atlas/auth/client/auth/KeycloakAuthenticationService.java b/client-auth/src/main/java/org/apache/atlas/auth/client/auth/KeycloakAuthenticationService.java index a3b3e9255e..444e63ce61 100644 --- a/client-auth/src/main/java/org/apache/atlas/auth/client/auth/KeycloakAuthenticationService.java +++ b/client-auth/src/main/java/org/apache/atlas/auth/client/auth/KeycloakAuthenticationService.java @@ -45,7 +45,7 @@ public KeycloakAuthenticationService(AuthConfig authConfig) { @NotNull private OkHttpClient getOkHttpClient() { HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); - interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); + interceptor.setLevel(HttpLoggingInterceptor.Level.BASIC); return new OkHttpClient.Builder() .addInterceptor(interceptor) .addInterceptor(responseLoggingInterceptor) From 3722974586e12d3e1dc7a6a87d6a3425a66355ef Mon Sep 17 00:00:00 2001 From: Suman Das <59254445+sumandas0@users.noreply.github.com> Date: Wed, 22 Jan 2025 00:04:05 +0530 Subject: [PATCH 17/23] fix: change logging level to NONE --- .../org/apache/atlas/auth/client/auth/AbstractAuthClient.java | 2 +- .../atlas/auth/client/auth/KeycloakAuthenticationService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client-auth/src/main/java/org/apache/atlas/auth/client/auth/AbstractAuthClient.java b/client-auth/src/main/java/org/apache/atlas/auth/client/auth/AbstractAuthClient.java index 43db5b8a27..8014933697 100644 --- a/client-auth/src/main/java/org/apache/atlas/auth/client/auth/AbstractAuthClient.java +++ b/client-auth/src/main/java/org/apache/atlas/auth/client/auth/AbstractAuthClient.java @@ -56,7 +56,7 @@ public AbstractAuthClient(AuthConfig authConfig) { this.authConfig = authConfig; this.metricUtils = new MetricUtils(); HttpLoggingInterceptor httpInterceptor = new HttpLoggingInterceptor(); - httpInterceptor.setLevel(HttpLoggingInterceptor.Level.BASIC); + httpInterceptor.setLevel(HttpLoggingInterceptor.Level.NONE); OkHttpClient okHttpClient = new OkHttpClient.Builder() .addInterceptor(accessTokenInterceptor) .addInterceptor(httpInterceptor) diff --git a/client-auth/src/main/java/org/apache/atlas/auth/client/auth/KeycloakAuthenticationService.java b/client-auth/src/main/java/org/apache/atlas/auth/client/auth/KeycloakAuthenticationService.java index 444e63ce61..162a350767 100644 --- a/client-auth/src/main/java/org/apache/atlas/auth/client/auth/KeycloakAuthenticationService.java +++ b/client-auth/src/main/java/org/apache/atlas/auth/client/auth/KeycloakAuthenticationService.java @@ -45,7 +45,7 @@ public KeycloakAuthenticationService(AuthConfig authConfig) { @NotNull private OkHttpClient getOkHttpClient() { HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); - interceptor.setLevel(HttpLoggingInterceptor.Level.BASIC); + interceptor.setLevel(HttpLoggingInterceptor.Level.NONE); return new OkHttpClient.Builder() .addInterceptor(interceptor) .addInterceptor(responseLoggingInterceptor) From 46b382236a98636005fb9907fe6a4dc02de384e8 Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Thu, 23 Jan 2025 12:49:58 +0530 Subject: [PATCH 18/23] Remove irrelevant files --- atlas-hub/atlas-logback.xml | 47 ----- .../main/assemblies/notification-analyzer.xml | 71 ------- pom.xml | 45 +---- .../main/resources/update-classifications.sh | 4 +- tools/notification-analyzer/pom.xml | 182 ------------------ .../src/main/java/org/apache/atlas/Atlas.java | 20 +- 6 files changed, 20 insertions(+), 349 deletions(-) delete mode 100755 atlas-hub/atlas-logback.xml delete mode 100644 distro/src/main/assemblies/notification-analyzer.xml delete mode 100644 tools/notification-analyzer/pom.xml diff --git a/atlas-hub/atlas-logback.xml b/atlas-hub/atlas-logback.xml deleted file mode 100755 index 2479258d6f..0000000000 --- a/atlas-hub/atlas-logback.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<configuration> - <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> - <param name="Target" value="System.out"/> - <encoder> - <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> - </encoder> - <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> - <level>INFO</level> - </filter> - </appender> - - <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${atlas.log.dir}/${atlas.log.file</file> - <append>true</append> - <encoder> - <pattern>%date [%thread] %level{5} [%file:%line] %msg%n</pattern> - </encoder> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${atlas.log.dir}/${atlas.log.file}-%d</fileNamePattern> - <maxHistory>20</maxHistory> - <cleanHistoryOnStart>true</cleanHistoryOnStart> - </rollingPolicy> - </appender> - - <root level="info"> - <appender-ref ref="FILE"/> - </root> -</configuration> diff --git a/distro/src/main/assemblies/notification-analyzer.xml b/distro/src/main/assemblies/notification-analyzer.xml deleted file mode 100644 index eee78f6c49..0000000000 --- a/distro/src/main/assemblies/notification-analyzer.xml +++ /dev/null @@ -1,71 +0,0 @@ -<!-- -** -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you 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. -* -* ---> -<assembly> - <id>notification-analyzer</id> - <formats> - <format>zip</format> - </formats> - - <baseDirectory>notification-analyzer</baseDirectory> - - <fileSets> - <fileSet> - <includes> - <include>README*</include> - </includes> - </fileSet> - <fileSet> - <directory>../tools/notification-analyzer/target/dependency</directory> - <outputDirectory>.</outputDirectory> - </fileSet> - <fileSet> - <directory>../tools/notification-analyzer/scripts</directory> - <outputDirectory>.</outputDirectory> - <includes> - <include>*.sh</include> - </includes> - <fileMode>0755</fileMode> - <directoryMode>0755</directoryMode> - </fileSet> - <fileSet> - <directory>../tools/notification-analyzer/src/main/resources</directory> - <outputDirectory>.</outputDirectory> - <includes> - <include>atlas-logback.xml</include> - <include>atlas-application.properties</include> - </includes> - </fileSet> - <fileSet> - <directory>../tools/notification-analyzer</directory> - <outputDirectory>.</outputDirectory> - <includes> - <include>README</include> - </includes> - </fileSet> - <fileSet> - <directory>../tools/notification-analyzer/target</directory> - <outputDirectory>.</outputDirectory> - <includes> - <include>atlas-notification-analyzer-${project.version}.jar</include> - </includes> - </fileSet> - </fileSets> -</assembly> diff --git a/pom.xml b/pom.xml index cba8770e94..0ae7a14d30 100644 --- a/pom.xml +++ b/pom.xml @@ -170,8 +170,8 @@ <role>committer</role> <role>PMC</role> </roles> - <organization>Microsoft</organization> - <!--<organizationUrl>https://www.microsoft.com</organizationUrl>--> + <organization>SAP Inc.</organization> + <!--<organizationUrl>https://www.sap.com</organizationUrl>--> </developer> <developer> <id>chyzer</id> @@ -383,16 +383,6 @@ <organization>Privacera Inc</organization> <!--<organizationUrl>https://www.privacera.com</organizationUrl>--> </developer> - <developer> - <id>mandarambawane</id> - <name>Mandar Ambawane</name> - <email>mandarambawane@apache.org</email> - <timezone>Asia/Kolkata</timezone> - <roles> - <role>committer</role> - </roles> - <organization>Freestone Infotech</organization> - </developer> <developer> <id>mandy</id> <name>Mandy Chessell</name> @@ -459,37 +449,6 @@ </roles> <organization>Freestone Infotech</organization> </developer> - <developer> - <id>ppawar</id> - <name>Prasad Pawar</name> - <email>ppawar@apache.org</email> - <timezone>Asia/Kolkata</timezone> - <roles> - <role>committer</role> - </roles> - <organization>Freestone Infotech</organization> - </developer> - <developer> - <id>chaitalithombare</id> - <name>Chaitali Borole</name> - <email>chaitalithombare@apache.org</email> - <timezone>Asia/Kolkata</timezone> - <roles> - <role>committer</role> - </roles> - <organization>Freestone Infotech</organization> - </developer> - <developer> - <id>radhikakundam</id> - <name>Radhika Kundam</name> - <email>radhikakundam@apache.org</email> - <timezone>America/Los_Angeles</timezone> - <roles> - <role>committer</role> - </roles> - <organization>Cloudera Inc.</organization> - <!--<organizationUrl>https://www.cloudera.com</organizationUrl>--> - </developer> <developer> <id>rmani</id> <name>Ramesh Mani</name> diff --git a/tools/classification-updater/src/main/resources/update-classifications.sh b/tools/classification-updater/src/main/resources/update-classifications.sh index c11d5e19a1..189c8c6de1 100644 --- a/tools/classification-updater/src/main/resources/update-classifications.sh +++ b/tools/classification-updater/src/main/resources/update-classifications.sh @@ -50,7 +50,7 @@ export ATLAS_CONF=/usr/hdp/current/atlas-server/conf/ # log dir for applications ATLAS_LOG_DIR="/var/log/atlas" ATLAS_LOG_FILE="classification-updater.log" -LOG_CONFIG="${BASEDIR}/atlas-log4j.xml" +LOG_CONFIG="${BASEDIR}/atlas-logback.xml" # Construct Atlas classpath. for i in "/usr/hdp/current/atlas-server/server/webapp/atlas/WEB-INF/lib/"*.jar; do @@ -75,7 +75,7 @@ then CP=`cygpath -w -p ${CP}` fi -JAVA_PROPERTIES="$ATLAS_OPTS -Datlas.log.dir=$ATLAS_LOG_DIR -Datlas.log.file=$ATLAS_LOG_FILE -Dlog4j.configuration=file://$LOG_CONFIG" +JAVA_PROPERTIES="$ATLAS_OPTS -Datlas.log.dir=$ATLAS_LOG_DIR -Datlas.log.file=$ATLAS_LOG_FILE -Dlogback.configurationFile=file://$LOG_CONFIG" IMPORT_ARGS=$@ JVM_ARGS= diff --git a/tools/notification-analyzer/pom.xml b/tools/notification-analyzer/pom.xml deleted file mode 100644 index cfce6c8d92..0000000000 --- a/tools/notification-analyzer/pom.xml +++ /dev/null @@ -1,182 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>apache-atlas</artifactId> - <groupId>org.apache.atlas</groupId> - <version>3.0.0-SNAPSHOT</version> - <relativePath>../../</relativePath> - </parent> - <artifactId>atlas-notification-analyzer</artifactId> - <description>Apache Atlas Notification Analyzer</description> - <name>Apache Atlas Notification Analyzer</name> - <packaging>jar</packaging> - - <dependencies> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${slf4j.version}</version> - </dependency> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>${slf4j.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.atlas</groupId> - <artifactId>atlas-notification</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>commons-cli</groupId> - <artifactId>commons-cli</artifactId> - <version>${commons-cli.version}</version> - </dependency> - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - <version>${commons-collections.version}</version> - </dependency> - </dependencies> - - <profiles> - <profile> - <id>dist</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>copy-binaries</id> - <phase>package</phase> - <goals> - <goal>copy</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}/dependency</outputDirectory> - <overWriteReleases>false</overWriteReleases> - <overWriteSnapshots>false</overWriteSnapshots> - <overWriteIfNewer>true</overWriteIfNewer> - <artifactItems> - <artifactItem> - <groupId>${project.groupId}</groupId> - <artifactId>${project.artifactId}</artifactId> - <version>${project.version}</version> - </artifactItem> - <artifactItem> - <groupId>${project.groupId}</groupId> - <artifactId>atlas-intg</artifactId> - <version>${project.version}</version> - </artifactItem> - <artifactItem> - <groupId>${project.groupId}</groupId> - <artifactId>atlas-notification</artifactId> - <version>${project.version}</version> - </artifactItem> - <artifactItem> - <groupId>commons-cli</groupId> - <artifactId>commons-cli</artifactId> - <version>${commons-cli.version}</version> - </artifactItem> - <artifactItem> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - <version>${commons-codec.version}</version> - </artifactItem> - <artifactItem> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - <version>${commons-collections.version}</version> - </artifactItem> - <artifactItem> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>${commons-io.version}</version> - </artifactItem> - <artifactItem> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - </artifactItem> - <artifactItem> - <groupId>org.apache.commons</groupId> - <artifactId>commons-compress</artifactId> - <version>1.26.2</version> - </artifactItem> - <artifactItem> - <groupId>commons-configuration</groupId> - <artifactId>commons-configuration</artifactId> - <version>${commons-conf.version}</version> - </artifactItem> - <artifactItem> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - <version>${commons-lang.version}</version> - </artifactItem> - <artifactItem> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>${commons-logging.version}</version> - </artifactItem> - <artifactItem> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - <version>${jackson.version}</version> - </artifactItem> - <artifactItem> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - <version>${jackson.version}</version> - </artifactItem> - <artifactItem> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <version>${jackson.databind.version}</version> - </artifactItem> - <artifactItem> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>${logback.version}</version> - </artifactItem> - <artifactItem> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <version>${slf4j.version}</version> - </artifactItem> - <artifactItem> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>${slf4j.version}</version> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> -</project> diff --git a/webapp/src/main/java/org/apache/atlas/Atlas.java b/webapp/src/main/java/org/apache/atlas/Atlas.java index ede4172468..34a3a89ded 100755 --- a/webapp/src/main/java/org/apache/atlas/Atlas.java +++ b/webapp/src/main/java/org/apache/atlas/Atlas.java @@ -187,11 +187,23 @@ private static void setApplicationHome() { private static OpenTelemetry initializeOpenTelemetry() { - List<String> customResourceAttr = - Arrays.asList(AtlasConfiguration.OTEL_RESOURCE_ATTRIBUTES.getStringArray()); + String otelResourceAttributes = System.getenv("OTEL_RESOURCE_ATTRIBUTES"); + + List<String> customResourceAttr = null; + + if (otelResourceAttributes != null) { + // Split the environment variable by commas + String[] values = otelResourceAttributes.split(","); + customResourceAttr = Arrays.asList(values); + } else { + customResourceAttr = Arrays.asList(AtlasConfiguration.OTEL_RESOURCE_ATTRIBUTES.getStringArray()); + } + + String serviceName = System.getenv("OTEL_SERVICE_NAME") != null ? System.getenv("OTEL_SERVICE_NAME") : AtlasConfiguration.OTEL_SERVICE_NAME.getString(); + String otelEndpoint = System.getenv("OTEL_EXPORTER_OTLP_ENDPOINT") != null ? System.getenv("OTEL_EXPORTER_OTLP_ENDPOINT") : AtlasConfiguration.OTEL_EXPORTER_OTLP_ENDPOINT.getString(); ResourceBuilder resourceBuilder = Resource.getDefault().toBuilder() - .put(ResourceAttributes.SERVICE_NAME, AtlasConfiguration.OTEL_SERVICE_NAME.getString()); + .put(ResourceAttributes.SERVICE_NAME, serviceName); // Iterate through the ArrayList and add each attribute for (String attribute : customResourceAttr) { @@ -213,7 +225,7 @@ private static OpenTelemetry initializeOpenTelemetry() { .addLogRecordProcessor( BatchLogRecordProcessor.builder( OtlpGrpcLogRecordExporter.builder() - .setEndpoint(AtlasConfiguration.OTEL_EXPORTER_OTLP_ENDPOINT.getString()) + .setEndpoint(otelEndpoint) .build() ) .build() From c58d739b7038cd38599fa3eae869a1c343bdb951 Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Thu, 23 Jan 2025 13:04:02 +0530 Subject: [PATCH 19/23] undo pom upstream changes --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0ae7a14d30..d89b988917 100644 --- a/pom.xml +++ b/pom.xml @@ -164,7 +164,7 @@ <developer> <id>bstortz</id> <name>Barbara Stortz</name> - <email>barbara.stortz@gmail.com</email> + <email>bstortz@sap.com</email> <timezone>America/Los_Angeles</timezone> <roles> <role>committer</role> From cd9e34c7648be29a3c5a4e02f4588eb6264be668 Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Tue, 28 Jan 2025 17:33:14 +0530 Subject: [PATCH 20/23] add ranger indexes --- .../destination/Log4JAuditDestination.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java b/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java index 3499e5785d..adba162b28 100644 --- a/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java +++ b/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java @@ -20,9 +20,11 @@ package org.apache.atlas.audit.destination; import org.apache.atlas.audit.model.AuditEventBase; +import org.apache.atlas.audit.model.AuthzAuditEvent; import org.apache.atlas.audit.provider.MiscUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.slf4j.MDC; import java.util.Collection; import java.util.Properties; @@ -36,6 +38,16 @@ public class Log4JAuditDestination extends AuditDestination { public static final String PROP_LOG4J_LOGGER = "logger"; public static final String DEFAULT_LOGGER_PREFIX = "ranger.audit"; private String loggerName = null; + private static final String AUTH_AUDIT_USER = "reqUser"; + private static final String AUTH_AUDIT_ACTION = "access"; + private static final String AUTH_AUDIT_ENTITY_GUID = "entityGuid"; + private static final String AUTH_AUDIT_POLICY_ID = "policyId"; + private static final String AUTH_AUDIT_RESULT = "result"; + private static final String AUTH_AUDIT_RESOURCE= "resource"; + private static final String AUTH_AUDIT_CLIENT_IP = "cliIP"; + private static final String AUTH_AUDIT_AGENT = "agent"; + private static final String TRACE_ID = "trace_id"; + public Log4JAuditDestination() { logger.info("Log4JAuditDestination() called."); @@ -75,12 +87,41 @@ public boolean log(AuditEventBase event) { } if (event != null) { + recordLogAttributes(event); String eventStr = MiscUtil.stringify(event); logJSON(eventStr); + clearLogAttributes(event); } return true; } + private void recordLogAttributes(AuditEventBase event) { + if (event instanceof AuthzAuditEvent) { + MDC.put(AUTH_AUDIT_USER, ((AuthzAuditEvent) event).getUser()); + MDC.put(AUTH_AUDIT_ACTION, ((AuthzAuditEvent) event).getAction()); + MDC.put(AUTH_AUDIT_ENTITY_GUID, ((AuthzAuditEvent) event).getEntityGuid()); + MDC.put(AUTH_AUDIT_POLICY_ID, ((AuthzAuditEvent) event).getPolicyId()); + MDC.put(AUTH_AUDIT_RESOURCE, ((AuthzAuditEvent) event).getResourceType()); + MDC.put(AUTH_AUDIT_RESULT, String.valueOf(((AuthzAuditEvent) event).getAccessResult())); + MDC.put(AUTH_AUDIT_CLIENT_IP, ((AuthzAuditEvent) event).getClientIP()); + MDC.put(AUTH_AUDIT_AGENT, ((AuthzAuditEvent) event).getAgentId()); + MDC.put(TRACE_ID, MDC.get(TRACE_ID)); + } + } + + private void clearLogAttributes(AuditEventBase event) { + if (event instanceof AuthzAuditEvent) { + MDC.remove(AUTH_AUDIT_USER); + MDC.remove(AUTH_AUDIT_ACTION); + MDC.remove(AUTH_AUDIT_ENTITY_GUID); + MDC.remove(AUTH_AUDIT_POLICY_ID); + MDC.remove(AUTH_AUDIT_RESOURCE); + MDC.remove(AUTH_AUDIT_RESULT); + MDC.remove(AUTH_AUDIT_CLIENT_IP); + MDC.remove(AUTH_AUDIT_AGENT); + } + } + @Override public boolean log(Collection<AuditEventBase> events) { if (!auditLogger.isInfoEnabled()) { From 0111fbd83068c45a796a79033de1c2e04773193d Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Tue, 28 Jan 2025 17:38:23 +0530 Subject: [PATCH 21/23] remove trace id --- .../apache/atlas/audit/destination/Log4JAuditDestination.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java b/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java index adba162b28..a6337448e7 100644 --- a/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java +++ b/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java @@ -46,7 +46,6 @@ public class Log4JAuditDestination extends AuditDestination { private static final String AUTH_AUDIT_RESOURCE= "resource"; private static final String AUTH_AUDIT_CLIENT_IP = "cliIP"; private static final String AUTH_AUDIT_AGENT = "agent"; - private static final String TRACE_ID = "trace_id"; public Log4JAuditDestination() { @@ -105,7 +104,6 @@ private void recordLogAttributes(AuditEventBase event) { MDC.put(AUTH_AUDIT_RESULT, String.valueOf(((AuthzAuditEvent) event).getAccessResult())); MDC.put(AUTH_AUDIT_CLIENT_IP, ((AuthzAuditEvent) event).getClientIP()); MDC.put(AUTH_AUDIT_AGENT, ((AuthzAuditEvent) event).getAgentId()); - MDC.put(TRACE_ID, MDC.get(TRACE_ID)); } } From 89d031ec35e545a959f650deefb917618161779a Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Tue, 28 Jan 2025 17:40:55 +0530 Subject: [PATCH 22/23] fix variable name --- .../apache/atlas/audit/destination/Log4JAuditDestination.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java b/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java index a6337448e7..dc9495f1e6 100644 --- a/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java +++ b/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java @@ -39,7 +39,7 @@ public class Log4JAuditDestination extends AuditDestination { public static final String DEFAULT_LOGGER_PREFIX = "ranger.audit"; private String loggerName = null; private static final String AUTH_AUDIT_USER = "reqUser"; - private static final String AUTH_AUDIT_ACTION = "access"; + private static final String AUTH_AUDIT_ACTION = "action"; private static final String AUTH_AUDIT_ENTITY_GUID = "entityGuid"; private static final String AUTH_AUDIT_POLICY_ID = "policyId"; private static final String AUTH_AUDIT_RESULT = "result"; From 1f04397f4486771d08edffdbe115b0faa51dacd6 Mon Sep 17 00:00:00 2001 From: aarshi <aarshi.arora@atlan.com> Date: Tue, 28 Jan 2025 20:14:36 +0530 Subject: [PATCH 23/23] optimise casting --- .../destination/Log4JAuditDestination.java | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java b/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java index dc9495f1e6..ba4ead346d 100644 --- a/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java +++ b/auth-audits/src/main/java/org/apache/atlas/audit/destination/Log4JAuditDestination.java @@ -86,39 +86,40 @@ public boolean log(AuditEventBase event) { } if (event != null) { - recordLogAttributes(event); + recordLogAttributes(event); String eventStr = MiscUtil.stringify(event); logJSON(eventStr); - clearLogAttributes(event); + clearLogAttributes(event); } return true; } - private void recordLogAttributes(AuditEventBase event) { - if (event instanceof AuthzAuditEvent) { - MDC.put(AUTH_AUDIT_USER, ((AuthzAuditEvent) event).getUser()); - MDC.put(AUTH_AUDIT_ACTION, ((AuthzAuditEvent) event).getAction()); - MDC.put(AUTH_AUDIT_ENTITY_GUID, ((AuthzAuditEvent) event).getEntityGuid()); - MDC.put(AUTH_AUDIT_POLICY_ID, ((AuthzAuditEvent) event).getPolicyId()); - MDC.put(AUTH_AUDIT_RESOURCE, ((AuthzAuditEvent) event).getResourceType()); - MDC.put(AUTH_AUDIT_RESULT, String.valueOf(((AuthzAuditEvent) event).getAccessResult())); - MDC.put(AUTH_AUDIT_CLIENT_IP, ((AuthzAuditEvent) event).getClientIP()); - MDC.put(AUTH_AUDIT_AGENT, ((AuthzAuditEvent) event).getAgentId()); - } - } - - private void clearLogAttributes(AuditEventBase event) { - if (event instanceof AuthzAuditEvent) { - MDC.remove(AUTH_AUDIT_USER); - MDC.remove(AUTH_AUDIT_ACTION); - MDC.remove(AUTH_AUDIT_ENTITY_GUID); - MDC.remove(AUTH_AUDIT_POLICY_ID); - MDC.remove(AUTH_AUDIT_RESOURCE); - MDC.remove(AUTH_AUDIT_RESULT); + private void recordLogAttributes(AuditEventBase eventBase) { + if (eventBase instanceof AuthzAuditEvent) { + AuthzAuditEvent event = (AuthzAuditEvent) eventBase; + MDC.put(AUTH_AUDIT_USER, event.getUser()); + MDC.put(AUTH_AUDIT_ACTION, event.getAction()); + MDC.put(AUTH_AUDIT_ENTITY_GUID, event.getEntityGuid()); + MDC.put(AUTH_AUDIT_POLICY_ID, event.getPolicyId()); + MDC.put(AUTH_AUDIT_RESOURCE, event.getResourceType()); + MDC.put(AUTH_AUDIT_RESULT, String.valueOf(event.getAccessResult())); + MDC.put(AUTH_AUDIT_CLIENT_IP, event.getClientIP()); + MDC.put(AUTH_AUDIT_AGENT, event.getAgentId()); + } + } + + private void clearLogAttributes(AuditEventBase event) { + if (event instanceof AuthzAuditEvent) { + MDC.remove(AUTH_AUDIT_USER); + MDC.remove(AUTH_AUDIT_ACTION); + MDC.remove(AUTH_AUDIT_ENTITY_GUID); + MDC.remove(AUTH_AUDIT_POLICY_ID); + MDC.remove(AUTH_AUDIT_RESOURCE); + MDC.remove(AUTH_AUDIT_RESULT); MDC.remove(AUTH_AUDIT_CLIENT_IP); MDC.remove(AUTH_AUDIT_AGENT); - } - } + } + } @Override public boolean log(Collection<AuditEventBase> events) {