Browse Source

修正日志打印的问题

tags/1.1.0
shaozhuguang 5 years ago
parent
commit
d201c568de
66 changed files with 303 additions and 155 deletions
  1. +0
    -74
      source/base/src/main/resources/log4j2.xml
  2. +1
    -1
      source/deployment/deployment-gateway/src/main/resources/scripts/startup.sh
  3. +2
    -2
      source/deployment/deployment-peer/src/main/resources/scripts/ledger-init.sh
  4. +1
    -1
      source/deployment/deployment-peer/src/main/resources/scripts/startup.sh
  5. +8
    -8
      source/gateway/src/main/resources/log4j2.xml
  6. +6
    -2
      source/peer/src/main/java/com/jd/blockchain/peer/PeerServerBooter.java
  7. +6
    -3
      source/peer/src/main/java/com/jd/blockchain/peer/web/PeerTimeTasks.java
  8. +8
    -8
      source/peer/src/main/resources/log4j2.xml
  9. +19
    -19
      source/sdk/sdk-samples/src/main/java/com/jd/blockchain/sdk/samples/SDKDemo_Constant.java
  10. +56
    -0
      source/sdk/sdk-samples/src/main/java/com/jd/blockchain/sdk/samples/SDK_Threads_KvInsert_Demo.java
  11. BIN
      source/test/test-integration/runtime/LdeNezHHwrWNFYWF5n6RrbdyCoSPWZUreDhvv_0.mdl
  12. BIN
      source/test/test-integration/runtime/LdeNf7W5SZ1Xh1KXoQcbPEdPDM21nUsEp8zFN_0.mdl
  13. BIN
      source/test/test-integration/runtime/LdeNgxFpbzqTH3ZouX5vPv7A9M7pGWUjGJAan_0.mdl
  14. BIN
      source/test/test-integration/runtime/LdeNhGKHXohv3Bme6YgqPkETVQwDetmNFcdPK_0.mdl
  15. BIN
      source/test/test-integration/runtime/LdeNhpKuGE7bsrCsARipmdhFD7AGFFVkvzT6e_0.mdl
  16. BIN
      source/test/test-integration/runtime/LdeNi3yqaJ5G3N2rGLZbXLXJ1XF6ajiyXbdkR_0.mdl
  17. BIN
      source/test/test-integration/runtime/LdeNigyUzWXAySKzQH8W74sjXcQykK6Ss1eEH_0.mdl
  18. BIN
      source/test/test-integration/runtime/LdeNjhemDjb3aSg3SpMRzqUrhFZDygUNsKA3o_0.mdl
  19. BIN
      source/test/test-integration/runtime/LdeNkJg78L7L1KYv6Cqicqc5SmbCD9Y4bkpez_0.mdl
  20. BIN
      source/test/test-integration/runtime/LdeNmcdMwTeQ73C6MsKbMxhFQ2XCh6bPz7p21_0.mdl
  21. BIN
      source/test/test-integration/runtime/LdeNmnQmbpZS2QSXnJ73LeGDJmwkhDhyFsVjJ_0.mdl
  22. BIN
      source/test/test-integration/runtime/LdeNmpZN6vXC9i6pyhPpRxmBf7iiaPj7bhvN2_0.mdl
  23. BIN
      source/test/test-integration/runtime/LdeNmzy486oNRSzhS2z7QRVvVswxCyaz65wys_0.mdl
  24. BIN
      source/test/test-integration/runtime/LdeNnDgXmyep22ZyabbdtdEzCjxFiM9nLDiby_0.mdl
  25. BIN
      source/test/test-integration/runtime/LdeNnYU8txmjeRhi9rgiZSwAQHW632Q3rQZue_0.mdl
  26. BIN
      source/test/test-integration/runtime/LdeNoENuwCi3bVbhmoFG4w5mggmPsgGtpZMtF_0.mdl
  27. BIN
      source/test/test-integration/runtime/LdeNqAMP5kjnciodhTY6Pnf8o5qbBvFkEs25Q_0.mdl
  28. BIN
      source/test/test-integration/runtime/LdeNqr3pRJGZQFTUQgSZ6onhi7FVFDHkUXwd5_0.mdl
  29. BIN
      source/test/test-integration/runtime/LdeNrFwJSVujRK7RBizL46WC5cUtudARjfHvT_0.mdl
  30. BIN
      source/test/test-integration/runtime/LdeNroewGwCBmwFMgxUrEY4WgMq4GA54N82r5_0.mdl
  31. BIN
      source/test/test-integration/runtime/LdeNrpEqQFALAghHSLpjt2Zdx3k6SBqTCVsGA_0.mdl
  32. BIN
      source/test/test-integration/runtime/LdeNsH2ZedzAohTe6xRRZQvKJt4geSFfhmaoX_0.mdl
  33. BIN
      source/test/test-integration/runtime/LdeNstg544ncLvc9D94ezXmPFYUq4QoPVkEYL_0.mdl
  34. BIN
      source/test/test-integration/runtime/LdeNsxrjTsagkS53m7AWWKwnpvJ1YUGBGM3mC_0.mdl
  35. BIN
      source/test/test-integration/runtime/LdeNtFf3HuzSNV2oTyrdHW3XPtmKvHUWpBpyr_0.mdl
  36. BIN
      source/test/test-integration/runtime/LdeNtM6R2N5wMgUQw1jDyUZ8gHbaVDFgyMAVN_0.mdl
  37. BIN
      source/test/test-integration/runtime/LdeNtY59RJyvx45bj6fjkDocBGB9Nc7Sf4ymf_0.mdl
  38. BIN
      source/test/test-integration/runtime/LdeNu29NacEbeEKCXpDAu1BcU1R54gYVKpJBX_0.mdl
  39. BIN
      source/test/test-integration/runtime/LdeNuRZEjx2UN1nmcmGwdx1AqFc3uFaHrKtjX_0.mdl
  40. BIN
      source/test/test-integration/runtime/LdeNv7SiL1nujKFuns1cGmWiaKD49jryjcYeH_0.mdl
  41. BIN
      source/test/test-integration/runtime/LdeNveXpq25eUxab6N21rJgg4cw7BXvKfm2LV_0.mdl
  42. BIN
      source/test/test-integration/runtime/LdeNvfeFwgRQxftBuUpekDCZJMLFwbWxXpzri_0.mdl
  43. BIN
      source/test/test-integration/runtime/LdeNvpJH7no46KQpnyFyNnR7fxT3hWsUrYdgz_0.mdl
  44. BIN
      source/test/test-integration/runtime/LdeNxXeWNfmRAXJX5xPSpgq6JArNrxsPDLgX3_0.mdl
  45. BIN
      source/test/test-integration/runtime/LdeNxd6yNub5qWhB49eBPGKnwNf5smuhSShDb_0.mdl
  46. BIN
      source/test/test-integration/runtime/LdeNxzTy6YegizyRKxA1EH87wYdHHBDMLqwSZ_0.mdl
  47. BIN
      source/test/test-integration/runtime/LdeNy5TGpQhi4pz8jNDX3wz3VABLPuGbcvLin_0.mdl
  48. BIN
      source/test/test-integration/runtime/LdeNz6SbUf9WZUFnkcZK3o2qYcTcLPvikMLJz_0.mdl
  49. BIN
      source/test/test-integration/runtime/LdeNzBjCSBy9uQDyYqgiUkpm4zpe1Fs9gEhXK_0.mdl
  50. BIN
      source/test/test-integration/runtime/LdeNzH3wcSNAJDX5RtaNKFxw6UQJMzdcRQUTp_0.mdl
  51. BIN
      source/test/test-integration/runtime/LdeNzJu2FYBNyZo9Ue757Chjj9vsxYFAnMHSS_0.mdl
  52. BIN
      source/test/test-integration/runtime/LdeP11pE4f8TWU5DpqJJVnojuxScK4yRceAiX_0.mdl
  53. BIN
      source/test/test-integration/runtime/LdeP1Vzbe3vbn8rjgoGN9FwRGyW6192PASjLS_0.mdl
  54. BIN
      source/test/test-integration/runtime/LdeP2WzejQqJdREjbbpjTsNno863XTvjCemvL_0.mdl
  55. BIN
      source/test/test-integration/runtime/LdeP2o8X3tnzLUV5kvmnT1rU6tL48Mn9yKnSp_0.mdl
  56. BIN
      source/test/test-integration/runtime/LdeP3pQGeyQhZJxsHhBu48kaNwYKow4HvdAcA_0.mdl
  57. BIN
      source/test/test-integration/runtime/LdeP3sKx6RrxZVGoYdJAGUrttNMNwWU3JC2NV_0.mdl
  58. +9
    -4
      source/tools/tools-initializer-booter/src/main/java/com/jd/blockchain/tools/initializer/boot/LedgerInitCommandBooter.java
  59. +46
    -2
      source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerBindingConfig.java
  60. +12
    -1
      source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerInitCommand.java
  61. +13
    -0
      source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerInitProperties.java
  62. +52
    -0
      source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LogPrompter.java
  63. +2
    -6
      source/tools/tools-initializer/src/main/resources/application.properties
  64. +0
    -12
      source/tools/tools-initializer/src/main/resources/banner2.txt
  65. +0
    -12
      source/tools/tools-initializer/src/main/resources/banner3.txt
  66. +62
    -0
      source/tools/tools-initializer/src/main/resources/log4j2-init.xml

+ 0
- 74
source/base/src/main/resources/log4j2.xml View File

@@ -1,74 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--日志级别以及优先级排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
<!--Configuration后面的status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出 -->
<!--monitorInterval:Log4j能够自动检测修改配置 文件和重新配置本身,设置间隔秒数 -->
<configuration status="WARN" monitorInterval="60">
<!--先定义所有的appender -->
<appenders>
<!--这个输出控制台的配置 -->
<console name="Console" target="SYSTEM_OUT">
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch) -->
<ThresholdFilter level="error" onMatch="ACCEPT"
onMismatch="DENY" />
<!--输出日志的格式 -->
<PatternLayout
pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n" />
</console>
<!--文件会打印出所有信息,这个log每次运行程序会自动清空,由append属性决定,适合临时测试用 -->
<File name="log" fileName="../logs/test.log" append="false">
<PatternLayout
pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n" />
</File>
<!-- 这个会打印出所有的info及以下级别的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档 -->
<RollingFile name="PeerRollingInfo"
fileName="../logs/peer.out.info.log"
filePattern="../logs/$${date:yyyy-MM}/peer.out.info-%d{yyyy-MM-dd}-%i.log">
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch) -->
<ThresholdFilter level="info" onMatch="ACCEPT"
onMismatch="DENY" />
<PatternLayout
pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="100 MB" />
</Policies>
</RollingFile>
<RollingFile name="PeerRollingWarn"
fileName="../logs/peer.out.warn.log"
filePattern="../logs/$${date:yyyy-MM}/peer.out.warn-%d{yyyy-MM-dd}-%i.log">
<ThresholdFilter level="warn" onMatch="ACCEPT"
onMismatch="DENY" />
<PatternLayout
pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="100 MB" />
</Policies>
<!-- DefaultRolloverStrategy属性如不设置,则默认为最多同一文件夹下7个文件,这里设置了20 -->
<DefaultRolloverStrategy max="20" />
</RollingFile>
<RollingFile name="PeerRollingError"
fileName="../logs/peer.out.error.log"
filePattern="../logs/$${date:yyyy-MM}/peer.out.error-%d{yyyy-MM-dd}-%i.log">
<ThresholdFilter level="error" onMatch="ACCEPT"
onMismatch="DENY" />
<PatternLayout
pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="100 MB" />
</Policies>
</RollingFile>
</appenders>
<!--然后定义logger,只有定义了logger并引入的appender,appender才会生效 -->
<loggers>
<!--过滤掉spring的一些DEBUG信息 -->
<logger name="org.springframework" level="INFO"></logger>
<root level="all">
<appender-ref ref="Console" />
<appender-ref ref="PeerRollingInfo" />
<appender-ref ref="PeerRollingWarn" />
<appender-ref ref="PeerRollingError" />
</root>
</loggers>
</configuration>

+ 1
- 1
source/deployment/deployment-gateway/src/main/resources/scripts/startup.sh View File

@@ -5,5 +5,5 @@ GATEWAY=$(ls $HOME/lib | grep deployment-gateway-)
if [ ! -n "$GATEWAY" ]; then
echo "GateWay Is Null !!!"
else
nohup java -jar -server $HOME/lib/$GATEWAY -c $HOME/config/gateway.conf $* > gw.out 2>&1 &
nohup java -jar -server -Dgateway.log=$HOME $HOME/lib/$GATEWAY -c $HOME/config/gateway.conf $* >$HOME/bin/gw.out 2>&1 &
fi

+ 2
- 2
source/deployment/deployment-peer/src/main/resources/scripts/ledger-init.sh View File

@@ -5,5 +5,5 @@ boot_file=$(ls $HOME/libs | grep tools-initializer-booter-)
if [ ! -n "$boot_file" ]; then
echo "tools-initializer-booter is null"
else
java -jar $HOME/libs/$boot_file -l $HOME/config/init/local.conf -i $HOME/config/init/ledger.init $*
fi
java -jar -server -Dinit.log=$HOME $HOME/libs/$boot_file -l $HOME/config/init/local.conf -i $HOME/config/init/ledger.init $*
fi

+ 1
- 1
source/deployment/deployment-peer/src/main/resources/scripts/startup.sh View File

@@ -5,5 +5,5 @@ PEER=$(ls $HOME/system | grep deployment-peer-)
if [ ! -n "$PEER" ]; then
echo "Peer Is Null !!!"
else
nohup java -jar -server -Xmx2g -Xms2g $HOME/system/$PEER -home=$HOME -c $HOME/config/ledger-binding.conf -p 7080 $* &
nohup java -jar -server -Xmx2g -Xms2g -Dpeer.log=$HOME $HOME/system/$PEER -home=$HOME -c $HOME/config/ledger-binding.conf -p 7080 $* >$HOME/bin/peer.out 2>&1 &
fi

+ 8
- 8
source/gateway/src/main/resources/log4j2.xml View File

@@ -13,12 +13,12 @@
<PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>
</console>
<!--文件会打印出所有信息,这个log每次运行程序会自动清空,由append属性决定,适合临时测试用-->
<File name="log" fileName="../logs/test.log" append="false">
<File name="log" fileName="${sys:gateway.log}/logs/gateway.temp.log" append="false">
<PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>
</File>
<!-- 这个会打印出所有的info及以下级别的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档-->
<RollingFile name="GatewayRollingInfo" fileName="../logs/gateway.out.info.log"
filePattern="../logs/$${date:yyyy-MM}/gateway.out.info-%d{yyyy-MM-dd}-%i.log">
<RollingFile name="GatewayRollingInfo" fileName="${sys:gateway.log}/logs/gateway.info.log"
filePattern="${sys:gateway.log}/logs/$${date:yyyy-MM}/gateway.info-%d{yyyy-MM-dd}-%i.log">
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
@@ -27,8 +27,8 @@
<SizeBasedTriggeringPolicy size="100 MB"/>
</Policies>
</RollingFile>
<RollingFile name="GatewayRollingWarn" fileName="../logs/gateway.out.warn.log"
filePattern="../logs/$${date:yyyy-MM}/gateway.out.warn-%d{yyyy-MM-dd}-%i.log">
<RollingFile name="GatewayRollingWarn" fileName="${sys:gateway.log}/logs/gateway.warn.log"
filePattern="${sys:gateway.log}/logs/$${date:yyyy-MM}/gateway.out.warn-%d{yyyy-MM-dd}-%i.log">
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
<Policies>
@@ -38,8 +38,8 @@
<!-- DefaultRolloverStrategy属性如不设置,则默认为最多同一文件夹下7个文件,这里设置了20 -->
<DefaultRolloverStrategy max="20"/>
</RollingFile>
<RollingFile name="GatewayRollingError" fileName="../logs/gateway.out.error.log"
filePattern="../logs/$${date:yyyy-MM}/gateway.out.error-%d{yyyy-MM-dd}-%i.log">
<RollingFile name="GatewayRollingError" fileName="${sys:gateway.log}/logs/gateway.error.log"
filePattern="${sys:gateway.log}/logs/$${date:yyyy-MM}/gateway.error-%d{yyyy-MM-dd}-%i.log">
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
<Policies>
@@ -51,7 +51,7 @@
<!--然后定义logger,只有定义了logger并引入的appender,appender才会生效-->
<loggers>
<!--过滤掉spring的一些DEBUG信息-->
<logger name="org.springframework" level="INFO"></logger>
<logger name="org.springframework" level="INFO"/>
<root level="all">
<appender-ref ref="Console"/>
<appender-ref ref="GatewayRollingInfo"/>


+ 6
- 2
source/peer/src/main/java/com/jd/blockchain/peer/PeerServerBooter.java View File

@@ -58,8 +58,12 @@ public class PeerServerBooter {
if (ledgerBindConfigFile == null) {
ConsoleUtils.info("Load build-in default configuration ...");
ClassPathResource configResource = new ClassPathResource("ledger-binding.conf");
InputStream in = configResource.getInputStream();
ledgerBindingConfig = LedgerBindingConfig.resolve(in);

try (InputStream in = configResource.getInputStream()) {
ledgerBindingConfig = LedgerBindingConfig.resolve(in);
} catch (Exception e) {
throw e;
}
} else {
ConsoleUtils.info("Load configuration,ledgerBindConfigFile position="+ledgerBindConfigFile);
File file = new File(ledgerBindConfigFile);


+ 6
- 3
source/peer/src/main/java/com/jd/blockchain/peer/web/PeerTimeTasks.java View File

@@ -107,14 +107,17 @@ public class PeerTimeTasks implements ApplicationContextAware {
}

private LedgerBindingConfig loadLedgerBindingConfig() throws Exception {
LedgerBindingConfig ledgerBindingConfig;
LedgerBindingConfig ledgerBindingConfig = null;
ledgerBindConfigFile = PeerServerBooter.ledgerBindConfigFile;
LOGGER.debug("Load LedgerBindConfigFile path = {}",
ledgerBindConfigFile == null ? "Default" : ledgerBindConfigFile);
if (ledgerBindConfigFile == null) {
ClassPathResource configResource = new ClassPathResource("ledger-binding.conf");
InputStream in = configResource.getInputStream();
ledgerBindingConfig = LedgerBindingConfig.resolve(in);
try (InputStream in = configResource.getInputStream()) {
ledgerBindingConfig = LedgerBindingConfig.resolve(in);
} catch (Exception e) {
throw e;
}
} else {
File file = new File(ledgerBindConfigFile);
ledgerBindingConfig = LedgerBindingConfig.resolve(file);


+ 8
- 8
source/peer/src/main/resources/log4j2.xml View File

@@ -13,12 +13,12 @@
<PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>
</console>
<!--文件会打印出所有信息,这个log每次运行程序会自动清空,由append属性决定,适合临时测试用-->
<File name="log" fileName="../logs/test.log" append="false">
<File name="log" fileName="${sys:peer.log}/logs/peer.temp.log" append="false">
<PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>
</File>
<!-- 这个会打印出所有的info及以下级别的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档-->
<RollingFile name="PeerRollingInfo" fileName="../logs/peer.out.info.log"
filePattern="../logs/$${date:yyyy-MM}/peer.out.info-%d{yyyy-MM-dd}-%i.log">
<RollingFile name="PeerRollingInfo" fileName="${sys:peer.log}/logs/peer.info.log"
filePattern="${sys:peer.log}/logs/$${date:yyyy-MM}/peer.info-%d{yyyy-MM-dd}-%i.log">
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
@@ -27,8 +27,8 @@
<SizeBasedTriggeringPolicy size="100 MB"/>
</Policies>
</RollingFile>
<RollingFile name="PeerRollingWarn" fileName="../logs/peer.out.warn.log"
filePattern="../logs/$${date:yyyy-MM}/peer.out.warn-%d{yyyy-MM-dd}-%i.log">
<RollingFile name="PeerRollingWarn" fileName="${sys:peer.log}/logs/peer.warn.log"
filePattern="${sys:peer.log}/logs/$${date:yyyy-MM}/peer.warn-%d{yyyy-MM-dd}-%i.log">
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
<Policies>
@@ -38,8 +38,8 @@
<!-- DefaultRolloverStrategy属性如不设置,则默认为最多同一文件夹下7个文件,这里设置了20 -->
<DefaultRolloverStrategy max="20"/>
</RollingFile>
<RollingFile name="PeerRollingError" fileName="../logs/peer.out.error.log"
filePattern="../logs/$${date:yyyy-MM}/peer.out.error-%d{yyyy-MM-dd}-%i.log">
<RollingFile name="PeerRollingError" fileName="${sys:peer.log}/logs/peer.error.log"
filePattern="${sys:peer.log}/logs/$${date:yyyy-MM}/peer.error-%d{yyyy-MM-dd}-%i.log">
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
<Policies>
@@ -51,7 +51,7 @@
<!--然后定义logger,只有定义了logger并引入的appender,appender才会生效-->
<loggers>
<!--过滤掉spring的一些DEBUG信息-->
<logger name="org.springframework" level="INFO"></logger>
<logger name="org.springframework" level="INFO"/>
<root level="all">
<appender-ref ref="Console"/>
<appender-ref ref="PeerRollingInfo"/>


+ 19
- 19
source/sdk/sdk-samples/src/main/java/com/jd/blockchain/sdk/samples/SDKDemo_Constant.java View File

@@ -7,37 +7,37 @@ import java.io.File;

public class SDKDemo_Constant {

public static final String GW_IPADDR = "127.0.0.1";
// public static final String GW_IPADDR = "192.168.151.41";

public static final int GW_PORT = 11000;
// public static final int GW_PORT = 18081;

public static final String[] PUB_KEYS = {
"3snPdw7i7PjVKiTH2VnXZu5H8QmNaSXpnk4ei533jFpuifyjS5zzH9",
"3snPdw7i7PajLB35tEau1kmixc6ZrjLXgxwKbkv5bHhP7nT5dhD9eX",
"3snPdw7i7PZi6TStiyc6mzjprnNhgs2atSGNS8wPYzhbKaUWGFJt7x",
"3snPdw7i7PifPuRX7fu3jBjsb3rJRfDe9GtbDfvFJaJ4V4hHXQfhwk"};

public static final String[] PRIV_KEYS = {
"177gjzHTznYdPgWqZrH43W3yp37onm74wYXT4v9FukpCHBrhRysBBZh7Pzdo5AMRyQGJD7x",
"177gju9p5zrNdHJVEQnEEKF4ZjDDYmAXyfG84V5RPGVc5xFfmtwnHA7j51nyNLUFffzz5UT",
"177gjtwLgmSx5v1hFb46ijh7L9kdbKUpJYqdKVf9afiEmAuLgo8Rck9yu5UuUcHknWJuWaF",
"177gk1pudweTq5zgJTh8y3ENCTwtSFsKyX7YnpuKPo7rKgCkCBXVXh5z2syaTCPEMbuWRns"};
// public static final String GW_IPADDR = "127.0.0.1";
public static final String GW_IPADDR = "192.168.151.41";

// public static final int GW_PORT = 11000;
public static final int GW_PORT = 18081;

// public static final String[] PUB_KEYS = {
// "3snPdw7i7PXvEDgq96QyzcKhfWL4mgYspzKwvgXiuAidWb2rkRMgDY",
// "3snPdw7i7PjVKiTH2VnXZu5H8QmNaSXpnk4ei533jFpuifyjS5zzH9",
// "3snPdw7i7PajLB35tEau1kmixc6ZrjLXgxwKbkv5bHhP7nT5dhD9eX",
// "3snPdw7i7PZi6TStiyc6mzjprnNhgs2atSGNS8wPYzhbKaUWGFJt7x",
// "3snPdw7i7PifPuRX7fu3jBjsb3rJRfDe9GtbDfvFJaJ4V4hHXQfhwk"};
//
// public static final String[] PRIV_KEYS = {
// "177gjsxj2ezADGthZ4tGqWeCAqRAwtNvesPjRnyKqCb1huU8LKZmJ3HGZNMPKWQJK3DP1B2",
// "177gjzHTznYdPgWqZrH43W3yp37onm74wYXT4v9FukpCHBrhRysBBZh7Pzdo5AMRyQGJD7x",
// "177gju9p5zrNdHJVEQnEEKF4ZjDDYmAXyfG84V5RPGVc5xFfmtwnHA7j51nyNLUFffzz5UT",
// "177gjtwLgmSx5v1hFb46ijh7L9kdbKUpJYqdKVf9afiEmAuLgo8Rck9yu5UuUcHknWJuWaF",
// "177gk1pudweTq5zgJTh8y3ENCTwtSFsKyX7YnpuKPo7rKgCkCBXVXh5z2syaTCPEMbuWRns"};


public static final String[] PUB_KEYS = {
"3snPdw7i7PXvEDgq96QyzcKhfWL4mgYspzKwvgXiuAidWb2rkRMgDY",
"3snPdw7i7PajLB35tEau1kmixc6ZrjLXgxwKbkv5bHhP7nT5dhD9eX",
"3snPdw7i7PZi6TStiyc6mzjprnNhgs2atSGNS8wPYzhbKaUWGFJt7x",
"3snPdw7i7PifPuRX7fu3jBjsb3rJRfDe9GtbDfvFJaJ4V4hHXQfhwk"};

public static final String[] PRIV_KEYS = {
"177gjsxj2ezADGthZ4tGqWeCAqRAwtNvesPjRnyKqCb1huU8LKZmJ3HGZNMPKWQJK3DP1B2",
"177gju9p5zrNdHJVEQnEEKF4ZjDDYmAXyfG84V5RPGVc5xFfmtwnHA7j51nyNLUFffzz5UT",
"177gjtwLgmSx5v1hFb46ijh7L9kdbKUpJYqdKVf9afiEmAuLgo8Rck9yu5UuUcHknWJuWaF",
"177gk1pudweTq5zgJTh8y3ENCTwtSFsKyX7YnpuKPo7rKgCkCBXVXh5z2syaTCPEMbuWRns"};

public static final String PASSWORD = "abc";

public static final byte[] readChainCodes(String contractZip) {


+ 56
- 0
source/sdk/sdk-samples/src/main/java/com/jd/blockchain/sdk/samples/SDK_Threads_KvInsert_Demo.java View File

@@ -0,0 +1,56 @@
package com.jd.blockchain.sdk.samples;

import com.jd.blockchain.ledger.*;
import com.jd.blockchain.utils.codec.Base58Utils;

import java.util.Random;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class SDK_Threads_KvInsert_Demo extends SDK_Base_Demo {

public static void main(String[] args) throws Exception {
new SDK_Threads_KvInsert_Demo().executeThreadsInsert();
}

public void executeThreadsInsert() throws Exception {

final int MAX = 30;

final String dataAddress = "LdeNqP4S88t1YjkGQaCGbX95ygD6hA2B6yjp6";

ExecutorService threadPool = Executors.newFixedThreadPool(50);

final CountDownLatch latch = new CountDownLatch(MAX);

for (int i = 0; i < MAX; i++) {

threadPool.execute(() -> {
TransactionTemplate txTemp = blockchainService.newTransaction(ledgerHash);

String key = System.currentTimeMillis() + "-" +
System.nanoTime() + "-" +
new Random(Thread.currentThread().getId()).nextInt(1024);

txTemp.dataAccount(dataAddress).setText(key,"value1",-1);

// TX 准备就绪
PreparedTransaction prepTx = txTemp.prepare();
prepTx.sign(adminKey);

// 提交交易;
TransactionResponse response = prepTx.commit();

System.out.printf("Key = %s, Result = %s \r\n", key, response.isSuccess());

latch.countDown();

});
}

latch.await();
System.out.println("It is Over !!!");
System.exit(0);
}
}

BIN
source/test/test-integration/runtime/LdeNezHHwrWNFYWF5n6RrbdyCoSPWZUreDhvv_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNf7W5SZ1Xh1KXoQcbPEdPDM21nUsEp8zFN_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNgxFpbzqTH3ZouX5vPv7A9M7pGWUjGJAan_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNhGKHXohv3Bme6YgqPkETVQwDetmNFcdPK_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNhpKuGE7bsrCsARipmdhFD7AGFFVkvzT6e_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNi3yqaJ5G3N2rGLZbXLXJ1XF6ajiyXbdkR_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNigyUzWXAySKzQH8W74sjXcQykK6Ss1eEH_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNjhemDjb3aSg3SpMRzqUrhFZDygUNsKA3o_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNkJg78L7L1KYv6Cqicqc5SmbCD9Y4bkpez_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNmcdMwTeQ73C6MsKbMxhFQ2XCh6bPz7p21_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNmnQmbpZS2QSXnJ73LeGDJmwkhDhyFsVjJ_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNmpZN6vXC9i6pyhPpRxmBf7iiaPj7bhvN2_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNmzy486oNRSzhS2z7QRVvVswxCyaz65wys_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNnDgXmyep22ZyabbdtdEzCjxFiM9nLDiby_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNnYU8txmjeRhi9rgiZSwAQHW632Q3rQZue_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNoENuwCi3bVbhmoFG4w5mggmPsgGtpZMtF_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNqAMP5kjnciodhTY6Pnf8o5qbBvFkEs25Q_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNqr3pRJGZQFTUQgSZ6onhi7FVFDHkUXwd5_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNrFwJSVujRK7RBizL46WC5cUtudARjfHvT_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNroewGwCBmwFMgxUrEY4WgMq4GA54N82r5_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNrpEqQFALAghHSLpjt2Zdx3k6SBqTCVsGA_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNsH2ZedzAohTe6xRRZQvKJt4geSFfhmaoX_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNstg544ncLvc9D94ezXmPFYUq4QoPVkEYL_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNsxrjTsagkS53m7AWWKwnpvJ1YUGBGM3mC_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNtFf3HuzSNV2oTyrdHW3XPtmKvHUWpBpyr_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNtM6R2N5wMgUQw1jDyUZ8gHbaVDFgyMAVN_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNtY59RJyvx45bj6fjkDocBGB9Nc7Sf4ymf_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNu29NacEbeEKCXpDAu1BcU1R54gYVKpJBX_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNuRZEjx2UN1nmcmGwdx1AqFc3uFaHrKtjX_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNv7SiL1nujKFuns1cGmWiaKD49jryjcYeH_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNveXpq25eUxab6N21rJgg4cw7BXvKfm2LV_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNvfeFwgRQxftBuUpekDCZJMLFwbWxXpzri_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNvpJH7no46KQpnyFyNnR7fxT3hWsUrYdgz_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNxXeWNfmRAXJX5xPSpgq6JArNrxsPDLgX3_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNxd6yNub5qWhB49eBPGKnwNf5smuhSShDb_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNxzTy6YegizyRKxA1EH87wYdHHBDMLqwSZ_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNy5TGpQhi4pz8jNDX3wz3VABLPuGbcvLin_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNz6SbUf9WZUFnkcZK3o2qYcTcLPvikMLJz_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNzBjCSBy9uQDyYqgiUkpm4zpe1Fs9gEhXK_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNzH3wcSNAJDX5RtaNKFxw6UQJMzdcRQUTp_0.mdl View File


BIN
source/test/test-integration/runtime/LdeNzJu2FYBNyZo9Ue757Chjj9vsxYFAnMHSS_0.mdl View File


BIN
source/test/test-integration/runtime/LdeP11pE4f8TWU5DpqJJVnojuxScK4yRceAiX_0.mdl View File


BIN
source/test/test-integration/runtime/LdeP1Vzbe3vbn8rjgoGN9FwRGyW6192PASjLS_0.mdl View File


BIN
source/test/test-integration/runtime/LdeP2WzejQqJdREjbbpjTsNno863XTvjCemvL_0.mdl View File


BIN
source/test/test-integration/runtime/LdeP2o8X3tnzLUV5kvmnT1rU6tL48Mn9yKnSp_0.mdl View File


BIN
source/test/test-integration/runtime/LdeP3pQGeyQhZJxsHhBu48kaNwYKow4HvdAcA_0.mdl View File


BIN
source/test/test-integration/runtime/LdeP3sKx6RrxZVGoYdJAGUrttNMNwWU3JC2NV_0.mdl View File


+ 9
- 4
source/tools/tools-initializer-booter/src/main/java/com/jd/blockchain/tools/initializer/boot/LedgerInitCommandBooter.java View File

@@ -11,6 +11,8 @@ import java.util.List;

public class LedgerInitCommandBooter {

private static final String[] JAR_DIRS = new String[]{"libs", "system"};

public static void main(String[] args) {
// 加载当前包及../system包下的所有class
load();
@@ -32,7 +34,7 @@ public class LedgerInitCommandBooter {
Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
boolean accessible = method.isAccessible();
try {
if (accessible == false) {
if (!accessible) {
method.setAccessible(true);
}
// 获取系统类加载器
@@ -64,9 +66,12 @@ public class LedgerInitCommandBooter {
}
File file = new File(currPath);
loadJarFiles.addAll(dirJars(file));
// 获取上级路径
String systemPath = file.getParent() + File.separator + "system";
loadJarFiles.addAll(dirJars(new File(systemPath)));

for (String jarDir : JAR_DIRS) {
// 获取上级路径
String jarPath = file.getParent() + File.separator + jarDir;
loadJarFiles.addAll(dirJars(new File(jarPath)));
}
} catch (Exception e) {
throw new RuntimeException(e);
}


+ 46
- 2
source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerBindingConfig.java View File

@@ -35,6 +35,8 @@ public class LedgerBindingConfig {

// Participant Attribute Key;
public static final String PARTI_ADDRESS = PARTI_PREFIX + "address";
// 参与方名称
public static final String PARTI_NAME = PARTI_PREFIX + "name";
public static final String PARTI_PK_PATH = PARTI_PREFIX + "pk-path";
public static final String PARTI_PK = PARTI_PREFIX + "pk";
public static final String PARTI_PASSWORD = PARTI_PREFIX + "pwd";
@@ -47,6 +49,9 @@ public class LedgerBindingConfig {
public static final String DB_CONN = DB_PREFIX + "uri";
public static final String DB_PASSWORD = DB_PREFIX + "pwd";

// 账本名字
public static final String LEDGER_NAME = "name";

// ------------------------------

private Map<HashDigest, BindingConfig> bindings = new LinkedHashMap<>();
@@ -89,6 +94,7 @@ public class LedgerBindingConfig {
for (int i = 0; i < hashs.length; i++) {
writeLine(builder, "#第 %s 个账本[%s]的配置;", i + 1, hashs[i].toBase58());
BindingConfig binding = getLedger(hashs[i]);
writeLedger(builder, hashs[i], binding);
writeParticipant(builder, hashs[i], binding);
writeDB(builder, hashs[i], binding);
writeLine(builder);
@@ -113,11 +119,14 @@ public class LedgerBindingConfig {
// 参与方配置;
String partiAddressKey = String.join(ATTR_SEPERATOR, ledgerPrefix, PARTI_ADDRESS);
String partiPkPathKey = String.join(ATTR_SEPERATOR, ledgerPrefix, PARTI_PK_PATH);
String partiNameKey = String.join(ATTR_SEPERATOR, ledgerPrefix, PARTI_NAME);
String partiPKKey = String.join(ATTR_SEPERATOR, ledgerPrefix, PARTI_PK);
String partiPwdKey = String.join(ATTR_SEPERATOR, ledgerPrefix, PARTI_PASSWORD);

writeLine(builder, "#账本的当前共识参与方的节点地址 Address;");
writeLine(builder, "%s=%s", partiAddressKey, stringOf(binding.getParticipant().getAddress()));
writeLine(builder, "#账本的当前共识参与方的节点名称 NodeName;");
writeLine(builder, "%s=%s", partiNameKey, stringOf(binding.getParticipant().getName()));
writeLine(builder, "#账本的当前共识参与方的私钥文件的保存路径;");
writeLine(builder, "%s=%s", partiPkPathKey, stringOf(binding.getParticipant().getPkPath()));
writeLine(builder, "#账本的当前共识参与方的私钥内容(Base58编码);如果指定了,优先选用此属性,其次是 pk-path 属性;");
@@ -140,6 +149,16 @@ public class LedgerBindingConfig {
writeLine(builder);
}

private void writeLedger(StringBuilder builder, HashDigest ledgerHash, BindingConfig binding) {
String ledgerPrefix = String.join(ATTR_SEPERATOR, BINDING_PREFIX, ledgerHash.toBase58());
// 账本相关信息配置;
String ledgerNameKey = String.join(ATTR_SEPERATOR, ledgerPrefix, LEDGER_NAME);

writeLine(builder, "#账本的名称;");
writeLine(builder, "%s=%s", ledgerNameKey, stringOf(binding.getLedgerName()));
writeLine(builder);
}

private static String stringOf(Object obj) {
if (obj == null) {
return "";
@@ -219,11 +238,12 @@ public class LedgerBindingConfig {
// 参与方配置;
String partiAddrKey = String.join(ATTR_SEPERATOR, ledgerPrefix, PARTI_ADDRESS);
String partiPkPathKey = String.join(ATTR_SEPERATOR, ledgerPrefix, PARTI_PK_PATH);
String partiNameKey = String.join(ATTR_SEPERATOR, ledgerPrefix, PARTI_NAME);
String partiPKKey = String.join(ATTR_SEPERATOR, ledgerPrefix, PARTI_PK);
String partiPwdKey = String.join(ATTR_SEPERATOR, ledgerPrefix, PARTI_PASSWORD);

String strPartiAddr = getProperty(props, partiAddrKey, true);
binding.participant.address = strPartiAddr;
binding.participant.address = getProperty(props, partiAddrKey, true);
binding.participant.name = getProperty(props, partiNameKey, true);
binding.participant.pkPath = getProperty(props, partiPkPathKey, false);
binding.participant.pk = getProperty(props, partiPKKey, false);
binding.participant.password = getProperty(props, partiPwdKey, false);
@@ -247,6 +267,10 @@ public class LedgerBindingConfig {
String.format("No db connection config of participant of ledger binding[%s]!", ledgerHash));
}

// 设置账本名称
String ledgerNameKey = String.join(ATTR_SEPERATOR, ledgerPrefix, LEDGER_NAME);
binding.ledgerName = getProperty(props, ledgerNameKey, true);

return binding;
}

@@ -296,6 +320,9 @@ public class LedgerBindingConfig {

public static class BindingConfig {

private String ledgerName;

// 账本名字
private ParticipantBindingConfig participant = new ParticipantBindingConfig();

private DBConnectionConfig dbConnection = new DBConnectionConfig();
@@ -308,18 +335,35 @@ public class LedgerBindingConfig {
return dbConnection;
}

public void setLedgerName(String ledgerName) {
this.ledgerName = ledgerName;
}

public String getLedgerName() {
return ledgerName;
}
}

public static class ParticipantBindingConfig {

private String address;

private String name;

private String pkPath;

private String pk;

private String password;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getAddress() {
return address;
}


+ 12
- 1
source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerInitCommand.java View File

@@ -2,6 +2,8 @@ package com.jd.blockchain.tools.initializer;

import java.io.File;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -52,6 +54,8 @@ public class LedgerInitCommand {

private static final Prompter ANSWER_PROMPTER = new PresetAnswerPrompter("Y");

private static final Prompter LOG_PROMPTER = new LogPrompter();

/**
* 入口;
*
@@ -65,7 +69,7 @@ public class LedgerInitCommand {

try {
if (argSet.hasOption(MONITOR_OPT)) {
prompter = ANSWER_PROMPTER;
prompter = LOG_PROMPTER;
}

ArgEntry localArg = argSet.getArg(LOCAL_ARG);
@@ -178,7 +182,14 @@ public class LedgerInitCommand {

// generate binding config;
BindingConfig bindingConf = new BindingConfig();

// 设置账本名称
bindingConf.setLedgerName(ledgerInitProperties.getLedgerName());

bindingConf.getParticipant().setAddress(ledgerInitProperties.getConsensusParticipant(currId).getAddress());
// 设置参与方名称
bindingConf.getParticipant().setName(ledgerInitProperties.getConsensusParticipant(currId).getName());

String encodedPrivKey = KeyGenCommand.encodePrivKey(privKey, base58Pwd);
bindingConf.getParticipant().setPk(encodedPrivKey);
bindingConf.getParticipant().setPassword(base58Pwd);


+ 13
- 0
source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LedgerInitProperties.java View File

@@ -25,6 +25,9 @@ public class LedgerInitProperties {
// 账本种子;
public static final String LEDGER_SEED = "ledger.seed";

// 账本名称
public static final String LEDGER_NAME = "ledger.name";

// 声明的账本建立时间;
public static final String CREATED_TIME = "created-time";
// 创建时间的格式;
@@ -61,6 +64,8 @@ public class LedgerInitProperties {

private byte[] ledgerSeed;

private String ledgerName;

private List<ConsensusParticipantConfig> consensusParticipants = new ArrayList<>();

private String consensusProvider;
@@ -75,6 +80,10 @@ public class LedgerInitProperties {
return ledgerSeed.clone();
}

public String getLedgerName() {
return ledgerName;
}

public long getCreatedTime() {
return createdTime;
}
@@ -159,6 +168,10 @@ public class LedgerInitProperties {
byte[] ledgerSeed = HexUtils.decode(hexLedgerSeed);
LedgerInitProperties initProps = new LedgerInitProperties(ledgerSeed);

// 账本名称
String ledgerName = PropertiesUtils.getRequiredProperty(props, LEDGER_NAME);
initProps.ledgerName = ledgerName;

// 创建时间;
String strCreatedTime = PropertiesUtils.getRequiredProperty(props, CREATED_TIME);
try {


+ 52
- 0
source/tools/tools-initializer/src/main/java/com/jd/blockchain/tools/initializer/LogPrompter.java View File

@@ -0,0 +1,52 @@
package com.jd.blockchain.tools.initializer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LogPrompter implements Prompter {

private static final Logger LOGGER = LoggerFactory.getLogger(LogPrompter.class);

private static final String ANSWER_DEFAULT = "Yes";

private boolean debug = true;

@Override
public void info(String format, Object... args) {
LOGGER.info(format, args);
}

@Override
public void error(String format, Object... args) {
LOGGER.error(format, args);
}

@Override
public void error(Exception error, String format, Object... args) {
if (debug) {
error.printStackTrace();
LOGGER.error(error.toString());
}
}

@Override
public String confirm(String format, Object... args) {
return confirm("", format, args);
}

@Override
public String confirm(String tag, String format, Object... args) {
String msg = String.format(format, args);
LOGGER.info(msg);
return ANSWER_DEFAULT;
}

public boolean isDebug() {
return debug;
}

public void setDebug(boolean debug) {
this.debug = debug;
}

}

+ 2
- 6
source/tools/tools-initializer/src/main/resources/application.properties View File

@@ -1,17 +1,13 @@
server.address=127.0.0.1
server.port=8900
#server.ssl.key-store=classpath:mykeys.jks
#server.ssl.key-store-password=abc123
#server.ssl.key-password=abc123
server.tomcat.accesslog.enabled=true
debug=false
logging.config=classpath:log4j2-init.xml
#logging.file=logs/peer.log
logging.level.com.jd.blockchain=DEBUG
logging.level.org.org.springframework=DEBUG
spring.mvc.favicon.enabled=false
spring.mvc.favicon.enabled=false

+ 0
- 12
source/tools/tools-initializer/src/main/resources/banner2.txt View File

@@ -1,12 +0,0 @@

888888 8888888b. 888888b. 888 888 .d8888b. 888 d8b
"88b 888 "Y88b 888 "88b 888 888 d88P Y88b 888 Y8P
888 888 888 888 .88P 888 888 888 888 888
888 888 888 8888888K. 888 .d88b. .d8888b 888 888 888 88888b. 8888b. 888 88888b.
888 888 888 888 "Y88b 888 d88""88b d88P" 888 .88P 888 888 "88b "88b 888 888 "88b
888 888 888 888 888 888 888 888 888 888888K 888 888 888 888 .d888888 888 888 888
88P 888 .d88P 888 d88P 888 Y88..88P Y88b. 888 "88b Y88b d88P 888 888 888 888 888 888 888
888 8888888P" 8888888P" 888 "Y88P" "Y8888P 888 888 "Y8888P" 888 888 "Y888888 888 888 888
.d88P
.d88P"
888P"

+ 0
- 12
source/tools/tools-initializer/src/main/resources/banner3.txt View File

@@ -1,12 +0,0 @@

$$$$$\ $$$$$$$\ $$$$$$$\ $$\ $$\ $$$$$$\ $$\ $$\
\__$$ |$$ __$$\ $$ __$$\ $$ | $$ | $$ __$$\ $$ | \__|
$$ |$$ | $$ | $$ | $$ |$$ | $$$$$$\ $$$$$$$\ $$ | $$\ $$ / \__|$$$$$$$\ $$$$$$\ $$\ $$$$$$$\
$$ |$$ | $$ | $$$$$$$\ |$$ |$$ __$$\ $$ _____|$$ | $$ | $$ | $$ __$$\ \____$$\ $$ |$$ __$$\
$$\ $$ |$$ | $$ | $$ __$$\ $$ |$$ / $$ |$$ / $$$$$$ / $$ | $$ | $$ | $$$$$$$ |$$ |$$ | $$ |
$$ | $$ |$$ | $$ | $$ | $$ |$$ |$$ | $$ |$$ | $$ _$$< $$ | $$\ $$ | $$ |$$ __$$ |$$ |$$ | $$ |
\$$$$$$ |$$$$$$$ | $$$$$$$ |$$ |\$$$$$$ |\$$$$$$$\ $$ | \$$\ \$$$$$$ |$$ | $$ |\$$$$$$$ |$$ |$$ | $$ |
\______/ \_______/ \_______/ \__| \______/ \_______|\__| \__| \______/ \__| \__| \_______|\__|\__| \__|

+ 62
- 0
source/tools/tools-initializer/src/main/resources/log4j2-init.xml View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--日志级别以及优先级排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
<!--Configuration后面的status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出-->
<!--monitorInterval:Log4j能够自动检测修改配置 文件和重新配置本身,设置间隔秒数-->
<configuration status="WARN" monitorInterval="60">
<!--先定义所有的appender-->
<appenders>
<!--这个输出控制台的配置-->
<console name="Console" target="SYSTEM_OUT">
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
<!--输出日志的格式-->
<PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>
</console>
<!--文件会打印出所有信息,这个log每次运行程序会自动清空,由append属性决定,适合临时测试用-->
<File name="log" fileName="${sys:init.log}/logs/init.temp.log" append="false">
<PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>
</File>
<!-- 这个会打印出所有的info及以下级别的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档-->
<RollingFile name="InitRollingInfo" fileName="${sys:init.log}/logs/init.info.log"
filePattern="${sys:init.log}/logs/$${date:yyyy-MM}/init.info-%d{yyyy-MM-dd}-%i.log">
<!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="100 MB"/>
</Policies>
</RollingFile>
<RollingFile name="InitRollingWarn" fileName="${sys:init.log}/logs/init.warn.log"
filePattern="${sys:init.log}/logs/$${date:yyyy-MM}/init.warn-%d{yyyy-MM-dd}-%i.log">
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="100 MB"/>
</Policies>
<!-- DefaultRolloverStrategy属性如不设置,则默认为最多同一文件夹下7个文件,这里设置了20 -->
<DefaultRolloverStrategy max="20"/>
</RollingFile>
<RollingFile name="InitRollingError" fileName="${sys:init.log}/logs/init.error.log"
filePattern="${sys:init.log}/logs/$${date:yyyy-MM}/init.error-%d{yyyy-MM-dd}-%i.log">
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout pattern="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="100 MB"/>
</Policies>
</RollingFile>
</appenders>
<!--然后定义logger,只有定义了logger并引入的appender,appender才会生效-->
<loggers>
<!--过滤掉spring的一些DEBUG信息-->
<logger name="org.springframework" level="INFO"/>
<root level="all">
<appender-ref ref="Console"/>
<appender-ref ref="InitRollingInfo"/>
<appender-ref ref="InitRollingWarn"/>
<appender-ref ref="InitRollingError"/>
</root>
</loggers>
</configuration>

Loading…
Cancel
Save