* add Constants.java * Optimize the constants to the logging package for the client module
This commit is contained in:
parent
33427e83bf
commit
e4c5368147
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.alibaba.nacos.client.constant;
|
||||
|
||||
/**
|
||||
* All the constants.
|
||||
*
|
||||
* @author onew
|
||||
*/
|
||||
public class Constants {
|
||||
|
||||
public static class SysEnv {
|
||||
|
||||
public static final String USER_HOME = "user.home";
|
||||
|
||||
public static final String PROJECT_NAME = "project.name";
|
||||
|
||||
public static final String JM_LOG_PATH = "JM.LOG.PATH";
|
||||
|
||||
public static final String JM_SNAPSHOT_PATH = "JM.SNAPSHOT.PATH";
|
||||
|
||||
}
|
||||
|
||||
public static class Disk {
|
||||
|
||||
public static final String READ_ONLY = "r";
|
||||
|
||||
public static final String READ_WRITE = "rw";
|
||||
}
|
||||
|
||||
public static class HealthCheck {
|
||||
|
||||
public static final String UP = "UP";
|
||||
|
||||
public static final String DOWN = "DOWN";
|
||||
}
|
||||
|
||||
public static class Protocols {
|
||||
|
||||
public static final String HTTP = "http://";
|
||||
|
||||
public static final String HTTPS = "https://";
|
||||
}
|
||||
|
||||
}
|
@ -16,6 +16,7 @@
|
||||
|
||||
package com.alibaba.nacos.client.logging;
|
||||
|
||||
import com.alibaba.nacos.client.constant.Constants;
|
||||
import com.alibaba.nacos.common.utils.ConvertUtils;
|
||||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
|
||||
@ -33,13 +34,13 @@ public abstract class AbstractNacosLogging {
|
||||
|
||||
private static final String NACOS_LOGGING_DEFAULT_CONFIG_ENABLED_PROPERTY = "nacos.logging.default.config.enabled";
|
||||
|
||||
private static final String NACOS_LOGGING_PATH_PROPERTY = "JM.LOG.PATH";
|
||||
private static final String NACOS_LOGGING_PATH_DIR = "logs";
|
||||
|
||||
static {
|
||||
String loggingPath = System.getProperty(NACOS_LOGGING_PATH_PROPERTY);
|
||||
String loggingPath = System.getProperty(Constants.SysEnv.JM_LOG_PATH);
|
||||
if (StringUtils.isBlank(loggingPath)) {
|
||||
String userHome = System.getProperty("user.home");
|
||||
System.setProperty(NACOS_LOGGING_PATH_PROPERTY, userHome + File.separator + "logs");
|
||||
String userHome = System.getProperty(Constants.SysEnv.USER_HOME);
|
||||
System.setProperty(Constants.SysEnv.JM_LOG_PATH, userHome + File.separator + NACOS_LOGGING_PATH_DIR);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user