You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/07/15 00:21:15 UTC
[GitHub] [incubator-shardingsphere] tristaZero commented on a change in pull
request #2701: Log configuration from reg center into log files
tristaZero commented on a change in pull request #2701: Log configuration from reg center into log files
URL: https://github.com/apache/incubator-shardingsphere/pull/2701#discussion_r303247625
##########
File path: sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/util/ConfigurationLogger.java
##########
@@ -0,0 +1,127 @@
+/*
+ * 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.shardingsphere.core.util;
+
+import java.util.Properties;
+
+import org.apache.shardingsphere.api.config.RuleConfiguration;
+import org.apache.shardingsphere.api.config.encryptor.EncryptRuleConfiguration;
+import org.apache.shardingsphere.api.config.masterslave.MasterSlaveRuleConfiguration;
+import org.apache.shardingsphere.api.config.sharding.ShardingRuleConfiguration;
+import org.apache.shardingsphere.core.rule.Authentication;
+import org.apache.shardingsphere.core.yaml.engine.YamlEngine;
+import org.apache.shardingsphere.core.yaml.swapper.impl.AuthenticationYamlSwapper;
+import org.apache.shardingsphere.core.yaml.swapper.impl.EncryptRuleConfigurationYamlSwapper;
+import org.apache.shardingsphere.core.yaml.swapper.impl.MasterSlaveRuleConfigurationYamlSwapper;
+import org.apache.shardingsphere.core.yaml.swapper.impl.ShardingRuleConfigurationYamlSwapper;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * Configuration printer class.
+ *
+ * @author sunbufu
+ */
+@Slf4j
+public final class ConfigurationLogger {
+
+ private ConfigurationLogger() { }
+
+ /**
+ * log properties configuration.
+ *
+ * @param propsConfiguration properties configuration
+ */
+ public static void log(final Properties propsConfiguration) {
+ if (null != propsConfiguration) {
+ log(propsConfiguration.getClass().getSimpleName(), YamlEngine.marshal(propsConfiguration));
+ }
+ }
+
+ /**
+ * log EncryptRuleConfiguration.
+ *
+ * @param encryptRuleConfiguration encryptRule configuration
+ */
+ public static void log(final EncryptRuleConfiguration encryptRuleConfiguration) {
+ if (null != encryptRuleConfiguration) {
Review comment:
if (null != encryptRuleConfiguration) {
return;
}
Will it be better?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services