Allow Atomix logging configuration to be overridden in stc tests
Change-Id: I67c4365859f380dd8c89c645b1a52f382c2595a4
diff --git a/tools/test/bin/atomix-config b/tools/test/bin/atomix-config
index f7decba..84b69fe 100755
--- a/tools/test/bin/atomix-config
+++ b/tools/test/bin/atomix-config
@@ -36,6 +36,5 @@
atomix-gen-config $node $CDEF_FILE
scp -q $CDEF_FILE $remote:$ATOMIX_INSTALL_DIR/atomix.json
-ssh -tt $ONOS_USER@$node "
- sed -i -e $'s/<logger name=\"io.atomix\" level=\"INFO\" \/>/<logger name=\"io.atomix\" level=\"INFO\" \/>\\\n <logger name=\"io.atomix.protocols.raft\" level=\"DEBUG\" \/>/g' /opt/atomix/conf/logback.xml
-"
+LOGBACK_FILE="$ONOS_ROOT"/tools/test/configs/atomix/logback.xml
+scp -q $LOGBACK_FILE $remote:/opt/atomix/conf/logback.xml
diff --git a/tools/test/bin/onos-config b/tools/test/bin/onos-config
index 65df721..6c9ad04 100755
--- a/tools/test/bin/onos-config
+++ b/tools/test/bin/onos-config
@@ -43,10 +43,8 @@
>> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/system.properties
# Drop copycat related log level for the console
- echo "log4j.logger.io.atomix=INFO" \
- >> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.ops4j.pax.logging.cfg
- echo "log4j.logger.io.atomix.cluster.messaging=ERROR" \
- >> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.ops4j.pax.logging.cfg
+ echo "log4j2.logger.atomix.name = io.atomix.protocols.raft" >> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.ops4j.pax.logging.cfg
+ echo "log4j2.logger.atomix.level = INFO" >> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.ops4j.pax.logging.cfg
# Patch the Apache Karaf distribution file to load ONOS boot features
perl -pi.old -e \"s|^(featuresBoot=.*,management)(,webconsole,.*)|\1,$ONOS_BOOT_FEATURES|\" \
diff --git a/tools/test/configs/atomix/logback.xml b/tools/test/configs/atomix/logback.xml
new file mode 100644
index 0000000..3c8ba34
--- /dev/null
+++ b/tools/test/configs/atomix/logback.xml
@@ -0,0 +1,50 @@
+<!--
+ ~ Copyright 2017-present Open Networking Foundation
+ ~
+ ~ 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.
+ -->
+<configuration>
+ <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${atomix.log.directory}/atomix.log</file>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${atomix.log.directory}/atomix.log.%i</fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>10MB</maxFileSize>
+ </triggeringPolicy>
+
+ <encoder>
+ <charset>UTF-8</charset>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="io.atomix" level="INFO" />
+ <logger name="io.atomix.protocols.raft" level="INFO" />
+ <logger name="io.netty.handler.logging.LoggingHandler" level="INFO"/>
+
+ <root level="INFO">
+ <appender-ref ref="FILE" />
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>
\ No newline at end of file