From 3fc69ee29faf7be4690c62b5fc84a8ab770a7f2b Mon Sep 17 00:00:00 2001 From: pengzhile Date: Tue, 30 Nov 2021 11:15:45 +0800 Subject: [PATCH] add a DebugInfo switch Signed-off-by: pengzhile --- README.md | 3 ++- .../java/io/zhile/research/ja/netfilter/commons/DebugInfo.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c02f7f9..bd699e6 100644 --- a/README.md +++ b/README.md @@ -49,4 +49,5 @@ EQUAL,somedomain ## Debug info * the `ja-netfilter` will **NOT** output debugging information by default -* add environment variable `JANF_DEBUG=1` and start to enable it \ No newline at end of file +* add environment variable `JANF_DEBUG=1` and start to enable it +* or add system property `-Djanf.debug=1` to enable it \ No newline at end of file diff --git a/src/main/java/io/zhile/research/ja/netfilter/commons/DebugInfo.java b/src/main/java/io/zhile/research/ja/netfilter/commons/DebugInfo.java index 027c99b..803a89c 100644 --- a/src/main/java/io/zhile/research/ja/netfilter/commons/DebugInfo.java +++ b/src/main/java/io/zhile/research/ja/netfilter/commons/DebugInfo.java @@ -3,7 +3,7 @@ package io.zhile.research.ja.netfilter.commons; import io.zhile.research.ja.netfilter.utils.DateUtils; public class DebugInfo { - private static final boolean DEBUG = "1".equals(System.getenv("JANF_DEBUG")); + private static final boolean DEBUG = "1".equals(System.getenv("JANF_DEBUG")) || "1".equals(System.getProperty("janf.debug")); public static void output(String content) { // No logger lib required if (!DEBUG) {