You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code captures all output from stdout/stderr originating from
our peer-launched docker containers and stuffs it into a custom
logger on a per-chaincode basis. It is enabled by the configuration
knob "CORE_VM_DOCKER_ATTACHSTDOUT=true" and defaults to disabled.
This should allow an admin or developer to enable this log at their
discretion to assist with debugging container problems, while
minimizing risk for malicious/faulty chaincodes to threaten the
peer with unmitigated logging.
Change-Id: I3f36958c41f14981e2e0f412b7e46589e6fa7110
Signed-off-by: Greg Haskins <[email protected]>
Copy file name to clipboardexpand all lines: docs/Setup/logging-control.md
+7-1
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,13 @@ settings):
60
60
61
61
## Go chaincodes
62
62
63
-
As independently executed programs, user-provided chaincodes can use any appropriate technique to create their private logs - from simple print statements to fully-annotated and level-controlled logs. The chaincode `shim` package provides APIs that allow a chaincode to create and manage logging objects whose logs will be formatted and interleaved consistently with the `shim` logs.
63
+
The standard mechanism to log within a chaincode application is to integrate with the logging transport exposed to each chaincode instance via the peer. The chaincode `shim` package provides APIs that allow a chaincode to create and manage logging objects whose logs will be formatted and interleaved consistently with the `shim` logs.
64
+
65
+
As independently executed programs, user-provided chaincodes may technically also produce output on stdout/stderr. While naturally useful for "devmode", these channels are normally disabled on a production network to mitigate abuse from broken or malicious code. However, it is possible to enable this output even for peer-managed containers (e.g. "netmode") on a per-peer basis via the CORE_VM_DOCKER_ATTACHSTDOUT=true configuration option.
66
+
67
+
Once enabled, each chaincode will receive its own logging channel keyed by its container-id. Any output written to either stdout or stderr will be integrated with the peer's log on a per-line basis. It is not recommended to enable this for production.
68
+
69
+
### API
64
70
65
71
`NewLogger(name string) *ChaincodeLogger` - Create a logging object for use by a chaincode
0 commit comments