Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve the issues of codestyle of nacos-config module for phase7 #3288

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private Object logClientRequest(String requestType, ProceedingJoinPoint pjp, Htt
final long rt = System.currentTimeMillis() - st;
// rt | status | requestIp | opType | dataId | group | datumId | md5 |
// appName
LogUtil.clientLog
LogUtil.CLIENT_LOG
.info("{}|{}|{}|{}|{}|{}|{}|{}|{}", rt, retVal, requestIp, requestType, dataId, group, tenant, md5,
appName);
return retVal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Page<PermissionInfo> getPermissions(String role, int pageNo, int pageSize
return pageInfo;

} catch (CannotGetJdbcConnectionException e) {
LogUtil.fatalLog.error("[db-error] " + e.toString(), e);
LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e);
throw e;
}
}
Expand All @@ -97,7 +97,7 @@ public void addPermission(String role, String resource, String action) {
try {
jt.update(sql, role, resource, action);
} catch (CannotGetJdbcConnectionException e) {
LogUtil.fatalLog.error("[db-error] " + e.toString(), e);
LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e);
throw e;
}
}
Expand All @@ -115,7 +115,7 @@ public void deletePermission(String role, String resource, String action) {
try {
jt.update(sql, role, resource, action);
} catch (CannotGetJdbcConnectionException e) {
LogUtil.fatalLog.error("[db-error] " + e.toString(), e);
LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e);
throw e;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public Page<RoleInfo> getRoles(int pageNo, int pageSize) {
}
return pageInfo;
} catch (CannotGetJdbcConnectionException e) {
LogUtil.fatalLog.error("[db-error] " + e.toString(), e);
LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e);
throw e;
}
}
Expand All @@ -98,7 +98,7 @@ public Page<RoleInfo> getRolesByUserName(String username, int pageNo, int pageSi
.fetchPage(sqlCountRows + where, sqlFetchRows + where, new ArrayList<String>().toArray(), pageNo,
pageSize, ROLE_INFO_ROW_MAPPER);
} catch (CannotGetJdbcConnectionException e) {
LogUtil.fatalLog.error("[db-error] " + e.toString(), e);
LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e);
throw e;
}
}
Expand All @@ -116,7 +116,7 @@ public void addRole(String role, String userName) {
try {
jt.update(sql, role, userName);
} catch (CannotGetJdbcConnectionException e) {
LogUtil.fatalLog.error("[db-error] " + e.toString(), e);
LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e);
throw e;
}
}
Expand All @@ -131,7 +131,7 @@ public void deleteRole(String role) {
try {
jt.update(sql, role);
} catch (CannotGetJdbcConnectionException e) {
LogUtil.fatalLog.error("[db-error] " + e.toString(), e);
LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e);
throw e;
}
}
Expand All @@ -147,7 +147,7 @@ public void deleteRole(String role, String username) {
try {
jt.update(sql, role, username);
} catch (CannotGetJdbcConnectionException e) {
LogUtil.fatalLog.error("[db-error] " + e.toString(), e);
LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e);
throw e;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void createUser(String username, String password) {
try {
jt.update(sql, username, password, true);
} catch (CannotGetJdbcConnectionException e) {
LogUtil.fatalLog.error("[db-error] " + e.toString(), e);
LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e);
throw e;
}
}
Expand All @@ -80,7 +80,7 @@ public void deleteUser(String username) {
try {
jt.update(sql, username);
} catch (CannotGetJdbcConnectionException e) {
LogUtil.fatalLog.error("[db-error] " + e.toString(), e);
LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e);
throw e;
}
}
Expand All @@ -95,7 +95,7 @@ public void updateUserPassword(String username, String password) {
try {
jt.update("UPDATE users SET password = ? WHERE username=?", password, username);
} catch (CannotGetJdbcConnectionException e) {
LogUtil.fatalLog.error("[db-error] " + e.toString(), e);
LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e);
throw e;
}
}
Expand All @@ -111,12 +111,12 @@ public User findUserByUsername(String username) {
try {
return this.jt.queryForObject(sql, new Object[] {username}, USER_ROW_MAPPER);
} catch (CannotGetJdbcConnectionException e) {
LogUtil.fatalLog.error("[db-error] " + e.toString(), e);
LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e);
throw e;
} catch (EmptyResultDataAccessException e) {
return null;
} catch (Exception e) {
LogUtil.fatalLog.error("[db-other-error]" + e.getMessage(), e);
LogUtil.FATAL_LOG.error("[db-other-error]" + e.getMessage(), e);
throw new RuntimeException(e);
}
}
Expand All @@ -141,7 +141,7 @@ public Page<User> getUsers(int pageNo, int pageSize) {
}
return pageInfo;
} catch (CannotGetJdbcConnectionException e) {
LogUtil.fatalLog.error("[db-error] " + e.toString(), e);
LogUtil.FATAL_LOG.error("[db-error] " + e.toString(), e);
throw e;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import java.util.List;
import java.util.Map;

import static com.alibaba.nacos.config.server.utils.LogUtil.pullLog;
import static com.alibaba.nacos.config.server.utils.LogUtil.PULL_LOG;

/**
* ConfigServlet inner for aop.
Expand Down Expand Up @@ -250,7 +250,7 @@ public String doGetConfig(HttpServletRequest request, HttpServletResponse respon
.transferTo(0L, fis.getChannel().size(), Channels.newChannel(response.getOutputStream()));
}

LogUtil.pullCheckLog.warn("{}|{}|{}|{}", groupKey, requestIp, md5, TimeUtils.getCurrentTimeStr());
LogUtil.PULL_CHECK_LOG.warn("{}|{}|{}|{}", groupKey, requestIp, md5, TimeUtils.getCurrentTimeStr());

final long delayed = System.currentTimeMillis() - lastModified;

Expand Down Expand Up @@ -281,7 +281,7 @@ public String doGetConfig(HttpServletRequest request, HttpServletResponse respon

} else {

pullLog.info("[client-get] clientIp={}, {}, get data during dump", clientIp, groupKey);
PULL_LOG.info("[client-get] clientIp={}, {}, get data during dump", clientIp, groupKey);

response.setStatus(HttpServletResponse.SC_CONFLICT);
response.getWriter().println("requested file is being modified, please try later.");
Expand Down Expand Up @@ -320,7 +320,7 @@ private static int tryConfigReadLock(String groupKey) {
try {
Thread.sleep(1);
} catch (Exception e) {
LogUtil.pullCheckLog.error("An Exception occurred while thread sleep", e);
LogUtil.PULL_CHECK_LOG.error("An Exception occurred while thread sleep", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import javax.servlet.ServletResponse;
import java.io.IOException;

import static com.alibaba.nacos.config.server.utils.LogUtil.defaultLog;
import static com.alibaba.nacos.config.server.utils.LogUtil.DEFAULT_LOG;

/**
* Web encode filter.
Expand Down Expand Up @@ -66,7 +66,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
try {
chain.doFilter(request, response);
} catch (IOException | ServletException ioe) {
defaultLog.debug("Filter catch exception, " + ioe.toString(), ioe);
DEFAULT_LOG.debug("Filter catch exception, " + ioe.toString(), ioe);
throw ioe;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
public final class TaskManager implements TaskManagerMBean {

private static final Logger LOGGER = LogUtil.defaultLog;
private static final Logger LOGGER = LogUtil.DEFAULT_LOG;

private final ConcurrentHashMap<String, AbstractTask> tasks = new ConcurrentHashMap<String, AbstractTask>();

Expand All @@ -62,7 +62,7 @@ public void run() {
Thread.sleep(100);
TaskManager.this.process();
} catch (Throwable e) {
LogUtil.dumpLog.error("execute dump process has error : {}", e);
LogUtil.DUMP_LOG.error("execute dump process has error : {}", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import java.util.concurrent.ScheduledThreadPoolExecutor;

import static com.alibaba.nacos.config.server.utils.LogUtil.memoryLog;
import static com.alibaba.nacos.config.server.utils.LogUtil.MEMORY_LOG;

/**
* NotifyTaskQueueMonitorTask.
Expand All @@ -38,7 +38,7 @@ public class NotifyTaskQueueMonitorTask implements Runnable {
@Override
public void run() {
int size = ((ScheduledThreadPoolExecutor) notifySingleService.getExecutor()).getQueue().size();
memoryLog.info("toNotifyTaskSize = {}", size);
MEMORY_LOG.info("toNotifyTaskSize = {}", size);
MetricsMonitor.getNotifyTaskMonitor().set(size);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.alibaba.nacos.config.server.monitor;

import static com.alibaba.nacos.config.server.utils.LogUtil.memoryLog;
import static com.alibaba.nacos.config.server.utils.LogUtil.MEMORY_LOG;

/**
* PrintGetConfigResponeTask.
Expand All @@ -26,7 +26,7 @@
public class PrintGetConfigResponeTask implements Runnable {
@Override
public void run() {
memoryLog.info(ResponseMonitor.getStringForPrint());
MEMORY_LOG.info(ResponseMonitor.getStringForPrint());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.alibaba.nacos.config.server.service.ClientTrackService;
import com.alibaba.nacos.config.server.service.ConfigCacheService;

import static com.alibaba.nacos.config.server.utils.LogUtil.memoryLog;
import static com.alibaba.nacos.config.server.utils.LogUtil.MEMORY_LOG;

/**
* @author zongtanghu
Expand All @@ -31,7 +31,7 @@ public void run() {
int groupCount = ConfigCacheService.groupCount();
int subClientCount = ClientTrackService.subscribeClientCount();
long subCount = ClientTrackService.subscriberCount();
memoryLog.info("groupCount = {}, subscriberClientCount = {}, subscriberCount = {}", groupCount, subClientCount,
MEMORY_LOG.info("groupCount = {}, subscriberClientCount = {}, subscriberCount = {}", groupCount, subClientCount,
subCount);
MetricsMonitor.getConfigCountMonitor().set(groupCount);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Pattern;

import static com.alibaba.nacos.config.server.utils.LogUtil.defaultLog;
import static com.alibaba.nacos.config.server.utils.LogUtil.fatalLog;
import static com.alibaba.nacos.config.server.utils.LogUtil.DEFAULT_LOG;
import static com.alibaba.nacos.config.server.utils.LogUtil.FATAL_LOG;

/**
* AggrWhitelist.
Expand Down Expand Up @@ -67,16 +67,16 @@ public static boolean isAggrDataId(String dataId) {
*/
public static void load(String content) {
if (StringUtils.isBlank(content)) {
fatalLog.error("aggr dataId whitelist is blank.");
FATAL_LOG.error("aggr dataId whitelist is blank.");
return;
}
defaultLog.warn("[aggr-dataIds] {}", content);
DEFAULT_LOG.warn("[aggr-dataIds] {}", content);

try {
List<String> lines = IoUtils.readLines(new StringReader(content));
compile(lines);
} catch (Exception ioe) {
defaultLog.error("failed to load aggr whitelist, " + ioe.toString(), ioe);
DEFAULT_LOG.error("failed to load aggr whitelist, " + ioe.toString(), ioe);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;

import static com.alibaba.nacos.config.server.utils.LogUtil.defaultLog;
import static com.alibaba.nacos.config.server.utils.LogUtil.DEFAULT_LOG;

/**
* Client ip whitelist.
Expand Down Expand Up @@ -69,18 +69,18 @@ public static boolean isEnableWhitelist() {
*/
public static void load(String content) {
if (StringUtils.isBlank(content)) {
defaultLog.warn("clientIpWhiteList is blank.close whitelist.");
DEFAULT_LOG.warn("clientIpWhiteList is blank.close whitelist.");
isOpen = false;
CLIENT_IP_WHITELIST.get().clear();
return;
}
defaultLog.warn("[clientIpWhiteList] {}", content);
DEFAULT_LOG.warn("[clientIpWhiteList] {}", content);
try {
AclInfo acl = (AclInfo) JSONUtils.deserializeObject(content, AclInfo.class);
isOpen = acl.getIsOpen();
CLIENT_IP_WHITELIST.set(acl.getIps());
} catch (Exception ioe) {
defaultLog.error("failed to load clientIpWhiteList, " + ioe.toString(), ioe);
DEFAULT_LOG.error("failed to load clientIpWhiteList, " + ioe.toString(), ioe);
}
}

Expand Down
Loading