Run smartcontract using maven

Normal execution:
mvn exec:java -Dexec.mainClass=”” -Dexec.args=”-a pearIp:port-i chaincodeName:version
Debug mode:
  • On CommandLine:
    • mvnDebug.cmd exec:java -Dexec.mainClass=”” -Dexec.args=”-a pearIp:port-i chaincodeName:version
    • Set and edit options if defaults are not ok:
      MAVEN_DEBUG_OPTS=”-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000″
  • On intellij: new Remote connection.

Apprenders and formating a default java.util.logger

java.util.logging.FileHandler.level = INFO
java.util.logging.FileHandler.pattern = log.%u.%g.txt
java.util.logging.SimpleFormatter.format= %1$tl:%1$tM:%1$tS %1$Tp %2$s %4$s: %5$s%n

More info about SimpleFormatter:

More Info about formatting params:

Surfing through logs with less

shift g: goes to end.
shift f: tails the file.

  – ctrl+c: switch to normal mode (no tails)

?: search upwards
/: search downward
 – n: search next match in current direction
 – shift n: search next match in counter direction
Also useful to find 2 or more words in one line is the regex:
Word1.+Word2 finds both words in the same line
As an extra to review logs, it is also useful the command grep with options after and before:
grep -A: lines after match
grep -B: lines before match