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

refact: modify abnormal logs #1948

Merged
merged 1 commit into from
Oct 8, 2022
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 @@ -45,7 +45,7 @@

public class API {

protected static final Logger LOG = Log.logger(RestServer.class);
protected static final Logger LOG = Log.logger(API.class);
Copy link
Member

@imbajin imbajin Sep 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it would be nice if the log-framework could support a unified approach like this (I don't know if there is a way) :
Logger LOG = Log.logger(this);


public static final String CHARSET = "UTF-8";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
@Tag(name = "AccessAPI")
public class AccessAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
Copy link
Member

@imbajin imbajin Aug 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RestServer 相关是有一定原因和考虑意义的, 另外它可以全局调整 rest-api 的所有日志级别.

这个改不改可以看看其他同学意见

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这块我能理解,但是看已有代码也不够统一

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这块我能理解,但是看已有代码也不够统一

嗯嗯后面有些修正是需要的 ✓ (那种一般是更新类名的时候没注意一起调整)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RestServer 相关是有一定原因和考虑意义的, 另外它可以全局调整 rest-api 的所有日志级别.

这个改不改可以看看其他同学意见

好像可以根据包路径配置日志的

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RestServer 相关是有一定原因和考虑意义的, 另外它可以全局调整 rest-api 的所有日志级别.
这个改不改可以看看其他同学意见

好像可以根据包路径配置日志的

是可以, 当然我指的是运行时动态调整日志级别 (不过那个也可以单独修改)

这里复用一个类名是不是有什么其他历史考量呢, 需要确认一下 @javeme

private static final Logger LOG = Log.logger(AccessAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
@Tag(name = "BelongAPI")
public class BelongAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(BelongAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
@Tag(name = "GroupAPI")
public class GroupAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(GroupAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
@Tag(name = "LoginAPI")
public class LoginAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(LoginAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
@Tag(name = "ProjectAPI")
public class ProjectAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(ProjectAPI.class);
private static final String ACTION_ADD_GRAPH = "add_graph";
private static final String ACTION_REMOVE_GRAPH = "remove_graph";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
@Tag(name = "TargetAPI")
public class TargetAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(TargetAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
@Tag(name = "UserAPI")
public class UserAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(UserAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class CompressInterceptor implements WriterInterceptor {

public static final String GZIP = "gzip";

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(CompressInterceptor.class);

// Set compress output buffer size to 4KB (about 40~600 vertices)
public static final int BUFFER_SIZE = 1024 * 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
@Tag(name = "ComputerAPI")
public class ComputerAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(ComputerAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
@Tag(name = "GremlinAPI")
public class GremlinAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(GremlinAPI.class);

private static final int MAX_NAME_LENGTH = 256;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
@Tag(name = "TaskAPI")
public class TaskAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(TaskAPI.class);
private static final long NO_LIMIT = -1L;

public static final String ACTION_CANCEL = "cancel";
Expand Down Expand Up @@ -185,4 +185,4 @@ private static TaskStatus parseStatus(String status) {
Arrays.asList(TaskStatus.values()), status));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
@Tag(name = "GraphsAPI")
public class GraphsAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(GraphsAPI.class);

private static final String CONFIRM_CLEAR = "I'm sure to delete all data";
private static final String CONFIRM_DROP = "I'm sure to drop the graph";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
@Tag(name = "AllShortestPathsAPI")
public class AllShortestPathsAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(AllShortestPathsAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
@Tag(name = "CountAPI")
public class CountAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(CountAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
@Tag(name = "CrosspointsAPI")
public class CrosspointsAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(CrosspointsAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
@Tag(name = "CustomizedCrosspointsAPI")
public class CustomizedCrosspointsAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(CustomizedCrosspointsAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
@Tag(name = "CustomizedPathsAPI")
public class CustomizedPathsAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(CustomizedPathsAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
@Tag(name = "EdgesAPI")
public class EdgesAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(EdgesAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
@Tag(name = "FusiformSimilarityAPI")
public class FusiformSimilarityAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(FusiformSimilarityAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
@Tag(name = "JaccardSimilarityAPI")
public class JaccardSimilarityAPI extends TraverserAPI {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(JaccardSimilarityAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
@Tag(name = "KneighborAPI")
public class KneighborAPI extends TraverserAPI {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(KneighborAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
@Tag(name = "KoutAPI")
public class KoutAPI extends TraverserAPI {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(KoutAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
@Tag(name = "MultiNodeShortestPathAPI")
public class MultiNodeShortestPathAPI extends TraverserAPI {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(MultiNodeShortestPathAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
@Tag(name = "NeighborRankAPI")
public class NeighborRankAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(NeighborRankAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
@Tag(name = "PathsAPI")
public class PathsAPI extends TraverserAPI {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(PathsAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
@Tag(name = "PersonalRankAPI")
public class PersonalRankAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(PersonalRankAPI.class);

private static final double DEFAULT_DIFF = 0.0001;
private static final double DEFAULT_ALPHA = 0.85;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
@Tag(name = "RaysAPI")
public class RaysAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(RaysAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
@Tag(name = "RingsAPI")
public class RingsAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(RingsAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
@Tag(name = "SameNeighborsAPI")
public class SameNeighborsAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(SameNeighborsAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
@Tag(name = "ShortestPathAPI")
public class ShortestPathAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(ShortestPathAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
@Tag(name = "SingleSourceShortestPathAPI")
public class SingleSourceShortestPathAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(SingleSourceShortestPathAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
@Tag(name = "TemplatePathsAPI")
public class TemplatePathsAPI extends TraverserAPI {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(TemplatePathsAPI.class);

@POST
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
@Tag(name = "VerticesAPI")
public class VerticesAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(VerticesAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
@Tag(name = "WeightedShortestPathAPI")
public class WeightedShortestPathAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(WeightedShortestPathAPI.class);

@GET
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
@Tag(name = "VariablesAPI")
public class VariablesAPI extends API {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(VariablesAPI.class);

@PUT
@Timed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
*/
public class ContextGremlinServer extends GremlinServer {

private static final Logger LOG = Log.logger(GremlinServer.class);
private static final Logger LOG = Log.logger(ContextGremlinServer.class);

private static final String G_PREFIX = "__g_";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

public final class GraphManager {

private static final Logger LOG = Log.logger(RestServer.class);
private static final Logger LOG = Log.logger(GraphManager.class);

private final String graphsDir;
private final Map<String, Graph> graphs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

public class LicenseVerifier {

private static final Logger LOG = Log.logger(HugeGraph.class);
private static final Logger LOG = Log.logger(LicenseVerifier.class);

private static final String LICENSE_PARAM_PATH = "/verify-license.json";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public abstract class CassandraTable
extends BackendTable<CassandraSessionPool.Session,
CassandraBackendEntry.Row> {

private static final Logger LOG = Log.logger(CassandraStore.class);
private static final Logger LOG = Log.logger(CassandraTable.class);
private static final int MAX_ELEMENTS_IN_CLAUSE = 65535;

public CassandraTable(String table) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

public class HugeFactory {

private static final Logger LOG = Log.logger(HugeGraph.class);
private static final Logger LOG = Log.logger(HugeFactory.class);

private static final Thread SHUT_DOWN_HOOK = new Thread(() -> {
LOG.info("HugeGraph is shutting down");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public class StandardHugeGraph implements HugeGraph {
CoreOptions.STORE
);

private static final Logger LOG = Log.logger(HugeGraph.class);
private static final Logger LOG = Log.logger(StandardHugeGraph.class);

private volatile boolean started;
private volatile boolean closed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public abstract class AbstractCache<K, V> implements Cache<K, V> {
public static final int DEFAULT_SIZE = 1 * MB;
public static final int MAX_INIT_CAP = 100 * MB;

protected static final Logger LOG = Log.logger(Cache.class);
protected static final Logger LOG = Log.logger(AbstractCache.class);

// The unit of expired time is ms
private volatile long expire;
Expand Down
Loading