support debug log and normal log

This commit is contained in:
CaiHQ 2022-06-11 05:34:40 +08:00
parent 1229c9ce4c
commit 5f42ed082c
6 changed files with 25 additions and 21 deletions

View File

@ -6,7 +6,7 @@ plugins {
} }
group = "org.bdware.sc" group = "org.bdware.sc"
version = "1.5.7" version = "1.6.0"
repositories { repositories {
mavenCentral() mavenCentral()
mavenLocal() mavenLocal()
@ -58,7 +58,7 @@ jar {
} }
from { from {
// uncomment this when publish! // uncomment this when publish!
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } // configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
} }
manifest { manifest {
attributes 'Manifest-Version': project.version attributes 'Manifest-Version': project.version
@ -75,10 +75,17 @@ task copyLibs(type: Copy, dependsOn: ":common:jar") {
from configurations.runtimeClasspath from configurations.runtimeClasspath
} }
task copyJar(type: Copy, dependsOn: ":cp:jar") { task copyJar(type: Copy, dependsOn: [":cp:jar",":copyLog4jProp"]) {
into "./build/output/" into "./build/output/"
from "./build/libs/$project.name-${version}.jar" from "./build/libs/$project.name-${version}.jar"
rename { String fileName -> "yjs.jar" } rename { String fileName -> "yjs.jar" }
from "./src/main/resources/log4j2.debug.properties"
from "./src/main/resources/log4j2.properties"
}
task copyLog4jProp(type: Copy) {
into "./build/output/"
from "./src/main/resources/log4j2.debug.properties"
from "./src/main/resources/log4j2.properties"
} }
task buildBundle(dependsOn: [":cp:copyLibs", ":cp:copyJar"]) { task buildBundle(dependsOn: [":cp:copyLibs", ":cp:copyJar"]) {

View File

@ -63,7 +63,7 @@ public class DebugMain {
= new ResultCallback() { = new ResultCallback() {
@Override @Override
public void onResult(String str) { public void onResult(String str) {
LOGGER.info(str); LOGGER.debug(str);
} }
}; };
ContractProcess.instance.handler.setDBInfo(wrap("", config.dbPath), printCallback); ContractProcess.instance.handler.setDBInfo(wrap("", config.dbPath), printCallback);

View File

@ -722,7 +722,7 @@ public class ContractProcess {
arg = new JsonPrimitive(""); arg = new JsonPrimitive("");
} }
onCreate.setArg(arg); onCreate.setArg(arg);
LOGGER.info("invoke onCreate, param:" + onCreate.getArg().toString()); LOGGER.debug("invoke onCreate, param:" + onCreate.getArg().toString());
onCreate.setRequester(contract.getOwner()); onCreate.setRequester(contract.getOwner());
if (contract.getDoipFlag() && null != contract.getDOI() && !contract.getDOI().isEmpty()) { if (contract.getDoipFlag() && null != contract.getDOI() && !contract.getDOI().isEmpty()) {
onCreate.setRequesterDOI(contract.getDOI()); onCreate.setRequesterDOI(contract.getDOI());

View File

@ -1,8 +0,0 @@
### 设置###
log4j.rootLogger = debug,stdout
### 输出信息到控制抬 ###
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target = System.out
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = [%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n

View File

@ -0,0 +1,10 @@
filter.threshold.type=ThresholdFilter
filter.threshold.level=all
appender.console.type=Console
appender.console.name=STDOUT
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=%highlight{[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n}{FATAL=Bright Red,ERROR=Red,WARN=Yellow,INFO=Green,DEBUG=Blue,TRACE=White}
rootLogger.level=all
rootLogger.appenderRef.stdout.ref=STDOUT
rootLogger.appenderRef.log.ref=log

View File

@ -1,15 +1,10 @@
filter.threshold.type=ThresholdFilter filter.threshold.type=ThresholdFilter
filter.threshold.level=debug filter.threshold.level=error
appender.console.type=Console appender.console.type=Console
appender.console.name=STDOUT appender.console.name=STDOUT
appender.console.layout.type=PatternLayout appender.console.layout.type=PatternLayout
appender.console.layout.pattern=%highlight{[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n}{FATAL=Bright Red,ERROR=Red,WARN=Yellow,INFO=Green,DEBUG=Blue,TRACE=White} appender.console.layout.pattern=%highlight{[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n}{FATAL=Bright Red,ERROR=Red,WARN=Yellow,INFO=Green,DEBUG=Blue,TRACE=White}
appender.rolling.type=File
appender.rolling.name=log rootLogger.level=error
appender.rolling.append=true
appender.rolling.fileName=./log/ct.log
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=%d-%m%n
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT rootLogger.appenderRef.stdout.ref=STDOUT
rootLogger.appenderRef.log.ref=log rootLogger.appenderRef.log.ref=log