Dzahn has submitted this change and it was merged.

Change subject: Gerrit: puppetize log4j.properties
......................................................................


Gerrit: puppetize log4j.properties

Copied from upstream, with an addition for us to handle silencing
weird cookie spam. Done as an erb template because I want to do
T141324 soon and it needs to be configurable

Change-Id: Ie0c4c0aa20257474377a89fde599b3460466e662
---
M modules/gerrit/manifests/jetty.pp
M modules/gerrit/templates/gerrit.config.erb
A modules/gerrit/templates/log4j.properties.erb
3 files changed, 71 insertions(+), 2 deletions(-)

Approvals:
  Dzahn: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/gerrit/manifests/jetty.pp 
b/modules/gerrit/manifests/jetty.pp
index ec54c37..93b7952 100644
--- a/modules/gerrit/manifests/jetty.pp
+++ b/modules/gerrit/manifests/jetty.pp
@@ -94,6 +94,14 @@
         require => File['/var/lib/gerrit2/review_site/etc'],
     }
 
+    file { '/var/lib/gerrit2/review_site/etc/log4j.properties':
+        content => template('gerrit/log4j.properties.erb'),
+        owner   => 'gerrit2',
+        group   => 'gerrit2',
+        mode    => '0660',
+        require => File['/var/lib/gerrit2/review_site/etc'],
+    }
+
     if $ssh_host_key != undef {
         file { '/var/lib/gerrit2/review_site/etc/ssh_host_key':
             content => secret("gerrit/${ssh_host_key}"),
@@ -145,8 +153,11 @@
 
     service { 'gerrit':
         ensure    => running,
-        subscribe => [File['/var/lib/gerrit2/review_site/etc/gerrit.config'],
-                    File['/var/lib/gerrit2/review_site/etc/secure.config']],
+        subscribe => [
+            File['/var/lib/gerrit2/review_site/etc/gerrit.config'],
+            File['/var/lib/gerrit2/review_site/etc/secure.config'],
+            File['/var/lib/gerrit2/review_site/etc/log4j.properties']
+        ],
         enable    => true,
         hasstatus => false,
         status    => '/etc/init.d/gerrit check',
diff --git a/modules/gerrit/templates/gerrit.config.erb 
b/modules/gerrit/templates/gerrit.config.erb
index 880bb18..07d85e3 100644
--- a/modules/gerrit/templates/gerrit.config.erb
+++ b/modules/gerrit/templates/gerrit.config.erb
@@ -34,6 +34,7 @@
 [container]
     user = gerrit2
     javaHome = /usr/lib/jvm/java-7-openjdk-amd64/jre
+    javaOptions = 
-Dlog4j.configuration=file:///var/lib/gerrit2/review_site/etc/log4j.properties
     heapLimit = <%= @heap_limit %>
     slave = <%= @slave %>
 [sshd]
diff --git a/modules/gerrit/templates/log4j.properties.erb 
b/modules/gerrit/templates/log4j.properties.erb
new file mode 100644
index 0000000..54b0b95
--- /dev/null
+++ b/modules/gerrit/templates/log4j.properties.erb
@@ -0,0 +1,57 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+log4j.rootCategory=INFO, stderr
+log4j.appender.stderr=org.apache.log4j.ConsoleAppender
+log4j.appender.stderr.target=System.err
+log4j.appender.stderr.layout=org.apache.log4j.PatternLayout
+log4j.appender.stderr.layout.ConversionPattern=[%d] [%t] %-5p %c %x: %m%n
+
+# Silence non-critical messages from MINA SSHD.
+#
+log4j.logger.org.apache.mina=WARN
+log4j.logger.org.apache.sshd.common=WARN
+log4j.logger.org.apache.sshd.server=WARN
+log4j.logger.org.apache.sshd.common.keyprovider.AbstractFileKeyPairProvider=INFO
+log4j.logger.com.google.gerrit.sshd.GerritServerSession=WARN
+
+# Silence non-critical messages from mime-util.
+#
+log4j.logger.eu.medsea.mimeutil=WARN
+
+# Silence non-critical messages from openid4java
+#
+log4j.logger.org.apache.http=WARN
+log4j.logger.org.apache.xml=WARN
+log4j.logger.org.openid4java=WARN
+log4j.logger.org.openid4java.consumer.ConsumerManager=FATAL
+log4j.logger.org.openid4java.discovery.Discovery=ERROR
+log4j.logger.org.openid4java.server.RealmVerifier=ERROR
+log4j.logger.org.openid4java.message.AuthSuccess=ERROR
+
+# Silence non-critical messages from c3p0 (if used).
+#
+log4j.logger.com.mchange.v2.c3p0=WARN
+log4j.logger.com.mchange.v2.resourcepool=WARN
+log4j.logger.com.mchange.v2.sql=WARN
+
+# Silence non-critical messages from Velocity
+#
+log4j.logger.velocity=WARN
+
+# Silence non-critical messages from apache.http
+log4j.logger.org.apache.http=WARN
+
+# Silence non-fatal messages from cookie parsing
+log4j.logger.org.apache.http.client.protocol.ResponseProcessCookies=FATAL

-- 
To view, visit https://gerrit.wikimedia.org/r/315571
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie0c4c0aa20257474377a89fde599b3460466e662
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Dzahn <dz...@wikimedia.org>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to