Repository: ambari
Updated Branches:
  refs/heads/trunk 5dddc529f -> 49e91c38a


AMBARI-15818 - Ambari should manage Atlas log4j.xml


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/49e91c38
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/49e91c38
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/49e91c38

Branch: refs/heads/trunk
Commit: 49e91c38a42f4929442a34f156a6ab54c7bfab63
Parents: 5dddc52
Author: tbeerbower <tbeerbo...@hortonworks.com>
Authored: Tue Apr 12 13:59:31 2016 -0400
Committer: tbeerbower <tbeerbo...@hortonworks.com>
Committed: Tue Apr 12 13:59:31 2016 -0400

----------------------------------------------------------------------
 .../0.1.0.2.3/configuration/atlas-log4j.xml     | 134 +++++++++++++++++++
 .../ATLAS/0.1.0.2.3/metainfo.xml                |  11 ++
 .../0.1.0.2.3/package/files/atlas-log4j.xml     |  84 ------------
 .../ATLAS/0.1.0.2.3/package/scripts/metadata.py |   2 +-
 .../ATLAS/0.1.0.2.3/package/scripts/params.py   |   5 +
 .../stacks/2.3/ATLAS/test_metadata_server.py    |   4 +-
 .../test/python/stacks/2.3/configs/default.json |   5 +
 .../test/python/stacks/2.3/configs/secure.json  |   5 +
 .../stacks/2.5/ATLAS/test_atlas_server.py       |   4 +-
 .../test/python/stacks/2.5/configs/default.json |   5 +
 10 files changed, 172 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/49e91c38/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/configuration/atlas-log4j.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/configuration/atlas-log4j.xml
 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/configuration/atlas-log4j.xml
new file mode 100644
index 0000000..81f8e07
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/configuration/atlas-log4j.xml
@@ -0,0 +1,134 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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 supports_adding_forbidden="true">
+
+  <property>
+    <name>atlas_log_level</name>
+    <value>debug</value>
+    <description>Log level for atlas logging</description>
+  </property>
+
+  <property>
+    <name>audit_log_level</name>
+    <value>OFF</value>
+    <description>Log level for audit logging</description>
+  </property>
+
+  <property>
+    <name>content</name>
+    <description>Custom log4j.properties</description>
+    <value>
+      <![CDATA[
+<?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="{{log_dir}}/application.log"/>
+    <param name="Append" value="true"/>
+    <param name="Threshold" value="debug"/>
+    <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.DailyRollingFileAppender">
+    <param name="File" value="{{log_dir}}/audit.log"/>
+    <param name="Append" value="true"/>
+    <param name="Threshold" value="debug"/>
+    <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="{{atlas_log_level}}"/>
+    <appender-ref ref="FILE"/>
+  </logger>
+
+
+  <logger name="com.thinkaurelius.titan" additivity="false">
+    <level value="info"/>
+    <appender-ref ref="FILE"/>
+  </logger>
+
+  <logger name="org.elasticsearch" additivity="false">
+    <level value="info"/>
+    <appender-ref ref="FILE"/>
+  </logger>
+
+  <logger name="org.apache.lucene" additivity="false">
+    <level value="info"/>
+    <appender-ref ref="FILE"/>
+  </logger>
+
+  <logger name="com.google" additivity="false">
+    <level value="info"/>
+    <appender-ref ref="FILE"/>
+  </logger>
+
+  <logger name="AUDIT">
+    <level value="{{audit_log_level}}"/>
+    <appender-ref ref="AUDIT"/>
+  </logger>
+
+  <root>
+    <priority value="info"/>
+    <appender-ref ref="FILE"/>
+  </root>
+
+</log4j:configuration>
+      ]]>
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+  </property>
+
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/49e91c38/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/metainfo.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/metainfo.xml 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/metainfo.xml
index bad9e95..3172af3 100644
--- 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/metainfo.xml
+++ 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/metainfo.xml
@@ -53,6 +53,11 @@
             <fileName>atlas-env.sh</fileName>
             <dictionaryName>atlas-env</dictionaryName>
           </configFile>
+          <configFile>
+            <type>env</type>
+            <fileName>atlas-log4j.xml</fileName>
+            <dictionaryName>atlas-log4j</dictionaryName>
+          </configFile>
         </component>
 
         <component>
@@ -77,6 +82,11 @@
             <fileName>atlas-env.sh</fileName>
             <dictionaryName>atlas-env</dictionaryName>
           </configFile>
+          <configFile>
+            <type>env</type>
+            <fileName>atlas-log4j.xml</fileName>
+            <dictionaryName>atlas-log4j</dictionaryName>
+          </configFile>
         </component>
       </components>
 
@@ -104,6 +114,7 @@
       <configuration-dependencies>
         <config-type>application-properties</config-type>
         <config-type>atlas-env</config-type>
+        <config-type>atlas-log4j</config-type>
       </configuration-dependencies>
 
     </service>

http://git-wip-us.apache.org/repos/asf/ambari/blob/49e91c38/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/files/atlas-log4j.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/files/atlas-log4j.xml
 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/files/atlas-log4j.xml
deleted file mode 100644
index 42d3c47..0000000
--- 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/files/atlas-log4j.xml
+++ /dev/null
@@ -1,84 +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}/application.log"/>
-        <param name="Append" value="true"/>
-        <param name="Threshold" value="debug"/>
-        <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.DailyRollingFileAppender">
-        <param name="File" value="${atlas.log.dir}/audit.log"/>
-        <param name="Append" value="true"/>
-        <param name="Threshold" value="debug"/>
-        <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="FILE"/>
-    </logger>
-
-
-    <logger name="com.thinkaurelius.titan" additivity="false">
-        <level value="info"/>
-        <appender-ref ref="FILE"/>
-    </logger>
-
-    <logger name="org.elasticsearch" additivity="false">
-        <level value="info"/>
-        <appender-ref ref="FILE"/>
-    </logger>
-
-    <logger name="org.apache.lucene" additivity="false">
-        <level value="info"/>
-        <appender-ref ref="FILE"/>
-    </logger>
-
-    <logger name="com.google" additivity="false">
-        <level value="info"/>
-        <appender-ref ref="FILE"/>
-    </logger>
-
-    <logger name="AUDIT">
-        <level value="info"/>
-        <appender-ref ref="AUDIT"/>
-    </logger>
-
-    <root>
-        <priority value="info"/>
-        <appender-ref ref="FILE"/>
-    </root>
-
-</log4j:configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/49e91c38/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
index 91629e0..041e04e 100644
--- 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
+++ 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
@@ -88,7 +88,7 @@ def metadata():
          mode=0644,
          owner=params.metadata_user,
          group=params.user_group,
-         content=StaticFile('atlas-log4j.xml')
+         content=InlineTemplate(params.metadata_log4j_content)
     )
 
     if params.security_enabled:

http://git-wip-us.apache.org/repos/asf/ambari/blob/49e91c38/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
index 8c7872a..3443016 100644
--- 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
+++ 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
@@ -105,6 +105,11 @@ metadata_classpath = 
config['configurations']['atlas-env']['metadata_classpath']
 data_dir = config['configurations']['atlas-env']['metadata_data_dir']
 expanded_war_dir = os.environ['METADATA_EXPANDED_WEBAPP_DIR'] if 
'METADATA_EXPANDED_WEBAPP_DIR' in os.environ else '/var/lib/atlas/server/webapp'
 
+metadata_log4j_content = config['configurations']['atlas-log4j']['content']
+
+atlas_log_level = config['configurations']['atlas-log4j']['atlas_log_level']
+audit_log_level = config['configurations']['atlas-log4j']['audit_log_level']
+
 # smoke test
 smoke_test_user = config['configurations']['cluster-env']['smokeuser']
 smoke_test_password = 'smoke'

http://git-wip-us.apache.org/repos/asf/ambari/blob/49e91c38/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py 
b/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
index e52f29c..fd3ca81 100644
--- a/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
+++ b/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
@@ -90,7 +90,9 @@ class TestMetadataServer(RMFTestCase):
                                 mode=0755,
       )
       self.assertResourceCalled('File', '/etc/atlas/conf/atlas-log4j.xml',
-                                content=StaticFile('atlas-log4j.xml'),
+                                content=InlineTemplate(
+                                    self.getConfig()['configurations'][
+                                      'atlas-log4j']['content']),
                                 owner='atlas',
                                 group='hadoop',
                                 mode=0644,

http://git-wip-us.apache.org/repos/asf/ambari/blob/49e91c38/ambari-server/src/test/python/stacks/2.3/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/configs/default.json 
b/ambari-server/src/test/python/stacks/2.3/configs/default.json
index 032e140..f87a4b8 100644
--- a/ambari-server/src/test/python/stacks/2.3/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.3/configs/default.json
@@ -212,6 +212,11 @@
         "metadata_expanded_war_dir": "/var/lib/atlas/server/webapp",
         "metadata_conf_file": "application.properties"
       },
+      "atlas-log4j": {
+        "content": "<property><name>content</name><description>Custom 
log4j.properties</description><value></value></property>",
+        "atlas_log_level": "debug",
+        "audit_log_level": "OFF"
+      },
       "ranger-hbase-plugin-properties": {
             "ranger-hbase-plugin-enabled":"yes"
       },

http://git-wip-us.apache.org/repos/asf/ambari/blob/49e91c38/ambari-server/src/test/python/stacks/2.3/configs/secure.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/configs/secure.json 
b/ambari-server/src/test/python/stacks/2.3/configs/secure.json
index c08b691..524484f 100644
--- a/ambari-server/src/test/python/stacks/2.3/configs/secure.json
+++ b/ambari-server/src/test/python/stacks/2.3/configs/secure.json
@@ -204,6 +204,11 @@
       "metadata_expanded_war_dir": "/var/lib/atlas/server/webapp",
       "metadata_conf_file": "application.properties"
     },
+    "atlas-log4j": {
+      "content": "<property><name>content</name><description>Custom 
log4j.properties</description><value></value></property>",
+      "atlas_log_level": "debug",
+      "audit_log_level": "OFF"
+    },
     "ranger-hbase-plugin-properties": {
       "ranger-hbase-plugin-enabled":"yes"
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/49e91c38/ambari-server/src/test/python/stacks/2.5/ATLAS/test_atlas_server.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.5/ATLAS/test_atlas_server.py 
b/ambari-server/src/test/python/stacks/2.5/ATLAS/test_atlas_server.py
index 21d2907..a882189 100644
--- a/ambari-server/src/test/python/stacks/2.5/ATLAS/test_atlas_server.py
+++ b/ambari-server/src/test/python/stacks/2.5/ATLAS/test_atlas_server.py
@@ -87,7 +87,9 @@ class TestAtlasServer(RMFTestCase):
                               mode=0755,
                               )
     self.assertResourceCalled('File', '/etc/atlas/conf/atlas-log4j.xml',
-                              content=StaticFile('atlas-log4j.xml'),
+                              content=InlineTemplate(
+                                  self.getConfig()['configurations'][
+                                    'atlas-log4j']['content']),
                               owner='atlas',
                               group='hadoop',
                               mode=0644,

http://git-wip-us.apache.org/repos/asf/ambari/blob/49e91c38/ambari-server/src/test/python/stacks/2.5/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.5/configs/default.json 
b/ambari-server/src/test/python/stacks/2.5/configs/default.json
index da4d80c..ddf4c9a 100644
--- a/ambari-server/src/test/python/stacks/2.5/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.5/configs/default.json
@@ -212,6 +212,11 @@
       "metadata_expanded_war_dir": "/var/lib/atlas/server/webapp",
       "metadata_conf_file": "atlas-application.properties"
     },
+    "atlas-log4j": {
+      "content": "<property><name>content</name><description>Custom 
log4j.properties</description><value></value></property>",
+      "atlas_log_level": "debug",
+      "audit_log_level": "OFF"
+    },
     "ranger-hbase-plugin-properties": {
       "ranger-hbase-plugin-enabled":"yes"
     },

Reply via email to