You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2017/04/28 15:22:59 UTC

[18/50] [abbrv] airavata git commit: AIRAVATA-2363 Switch to logback for logging

AIRAVATA-2363 Switch to logback for logging

Used conversion utility to convert old log4j.properties to logback.xml
and then made a few small tweaks:
* slf4j/logback API doesn't have FATAL level
* %X instead of %x
* %c{30} instead of %c to get abbreviated fully qualified class name


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

Branch: refs/heads/develop
Commit: dca8e1431a80c20178c2ea2b1a33cea26eeaa27c
Parents: 9578e5c
Author: Marcus Christie <ma...@apache.org>
Authored: Tue Apr 11 15:52:50 2017 -0400
Committer: Marcus Christie <ma...@apache.org>
Committed: Tue Apr 11 17:17:25 2017 -0400

----------------------------------------------------------------------
 .../server/src/main/resources/log4j.properties  | 48 --------------
 .../server/src/main/resources/logback.xml       | 70 +++++++++++++-------
 .../src/main/assembly/bin-assembly.xml          |  2 +-
 3 files changed, 48 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/dca8e143/modules/configuration/server/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/modules/configuration/server/src/main/resources/log4j.properties b/modules/configuration/server/src/main/resources/log4j.properties
deleted file mode 100644
index ee67028..0000000
--- a/modules/configuration/server/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,48 +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.
-#
-
-# Set root category priority to INFO and its only appender to CONSOLE.
-log4j.rootCategory=INFO, CONSOLE,LOGFILE
-log4j.rootLogger=INFO, CONSOLE, LOGFILE
-
-# Set the enterprise logger priority to FATAL
-log4j.logger.org.apache.axis2.enterprise=FATAL
-log4j.logger.org.apache.airavata=INFO
-log4j.logger.de.hunsicker.jalopy.io=FATAL
-log4j.logger.httpclient.wire.header=FATAL
-log4j.logger.org.apache.commons.httpclient=FATAL
-log4j.logger.org.apache.zookeeper=FATAL
-log4j.logger.org.globus=INFO
-# following remove grouper info logs
-log4j.logger.edu.internet2.middleware.grouper=FATAL
-log4j.logger.org.hibernate=FATAL
-         
-# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=[%p] %m%n
-
-# LOGFILE is set to be a File appender using a PatternLayout.
-log4j.appender.LOGFILE=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.LOGFILE.File=../logs/airavata.log
-#Rollover at midnight each day.
-log4j.appender.LOGFILE.DatePattern='.'yyyy-MM-dd
-log4j.appender.LOGFILE.Append=true
-log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
-log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n

http://git-wip-us.apache.org/repos/asf/airavata/blob/dca8e143/modules/configuration/server/src/main/resources/logback.xml
----------------------------------------------------------------------
diff --git a/modules/configuration/server/src/main/resources/logback.xml b/modules/configuration/server/src/main/resources/logback.xml
index 4153f84..fa4ae1f 100644
--- a/modules/configuration/server/src/main/resources/logback.xml
+++ b/modules/configuration/server/src/main/resources/logback.xml
@@ -1,31 +1,55 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<configuration>
+<!--
 
-    <property name="DEV_HOME" value="../logs" />
 
-    <appender name="FILE-AUDIT"
-              class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>../logs/airavata.log</file>
-        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
-            <Pattern>
-                %d{yyyy-MM-dd HH:mm:ss} [%thread] %level %logger{35} - %msg%n
-            </Pattern>
-        </encoder>
+    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">
+        <encoder>
+            <pattern>[%p] %m%n</pattern>
+        </encoder>
+    </appender>
+    <appender name="LOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!--See http://logback.qos.ch/manual/appenders.html#RollingFileAppender-->
+        <!--and http://logback.qos.ch/manual/appenders.html#TimeBasedRollingPolicy-->
+        <!--for further documentation-->
+        <File>../logs/airavata.log</File>
+        <Append>true</Append>
+        <encoder>
+            <pattern>%d [%t] %-5p %c{30} %X - %m%n</pattern>
+        </encoder>
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <!-- rollover daily -->
-            <fileNamePattern>../logs/airavata.%d{yyyy-MM-dd}.%i.log
-            </fileNamePattern>
-            <timeBasedFileNamingAndTriggeringPolicy
-                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
-                <maxFileSize>10MB</maxFileSize>
-            </timeBasedFileNamingAndTriggeringPolicy>
+            <fileNamePattern>../logs/airavata.log.%d{yyyy-MM-dd}</fileNamePattern>
         </rollingPolicy>
-
     </appender>
-
-    <root level="info">
-        <appender-ref ref="FILE-AUDIT" />
+    <logger name="org.apache.zookeeper" level="ERROR"/>
+    <logger name="edu.internet2.middleware.grouper" level="ERROR"/>
+    <logger name="org.globus" level="INFO"/>
+    <logger name="org.apache.commons.httpclient" level="ERROR"/>
+    <logger name="org.apache.airavata" level="INFO"/>
+    <logger name="org.hibernate" level="ERROR"/>
+    <logger name="de.hunsicker.jalopy.io" level="ERROR"/>
+    <logger name="httpclient.wire.header" level="ERROR"/>
+    <logger name="org.apache.axis2.enterprise" level="ERROR"/>
+    <root level="INFO">
+        <appender-ref ref="CONSOLE"/>
+        <appender-ref ref="LOGFILE"/>
     </root>
-
-</configuration>
\ No newline at end of file
+</configuration>

http://git-wip-us.apache.org/repos/asf/airavata/blob/dca8e143/modules/distribution/src/main/assembly/bin-assembly.xml
----------------------------------------------------------------------
diff --git a/modules/distribution/src/main/assembly/bin-assembly.xml b/modules/distribution/src/main/assembly/bin-assembly.xml
index b0113f2..918396e 100644
--- a/modules/distribution/src/main/assembly/bin-assembly.xml
+++ b/modules/distribution/src/main/assembly/bin-assembly.xml
@@ -112,7 +112,7 @@
                 <include>airavata-server.properties</include>
                 <include>zoo.cfg</include>
                 <include>registry.properties</include>
-                <include>log4j.properties</include>
+                <include>logback.xml</include>
                 <include>host.xml</include>
                 <include>persistence.xml</include>
                 <include>provenance.sql</include>