Merge pull request #24 from arthurbarr/master

Logging updates
This commit is contained in:
Arthur Barr
2018-03-06 14:55:11 +00:00
committed by GitHub
5 changed files with 8 additions and 49 deletions

View File

@@ -65,6 +65,6 @@ RUN chmod ug+x /usr/local/bin/runmqserver \
# Always use port 1414
EXPOSE 1414
ENV LANG=en_US.UTF-8 AMQ_DIAGNOSTIC_MSG_SEVERITY=1 AMQ_ADDITIONAL_JSON_LOG=1 LOG_FORMAT=simple
ENV LANG=en_US.UTF-8 AMQ_DIAGNOSTIC_MSG_SEVERITY=1 AMQ_ADDITIONAL_JSON_LOG=1 LOG_FORMAT=basic
ENTRYPOINT ["runmqserver"]

View File

@@ -13,12 +13,7 @@ A. SUMMARY
===============================================================================
Section B. below contains provisions relating to certain other components of the Program, as follows:-
B.1 MIT license
Affected Components:
* sirupsen/logrus
Copyright (c) 2014 Simon Eskildsen
B.2 BSD 3-Clause license
B.1 BSD 3-Clause license
Affected Components:
* golang.org/x/crypto
Copyright (c) 2009 The Go Authors. All rights reserved.
@@ -32,30 +27,7 @@ END OF A. SUMMARY
B. LICENSE FILES AND OTHER INFORMATION
==========================================================================
==========================================================================
B.1 MIT license
==========================================================================
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
==========================================================================
END OF B.1 MIT license
==========================================================================
==========================================================================
B.2 BSD 3-Clause license
B.1 BSD 3-Clause license
==========================================================================
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -83,7 +55,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
==========================================================================
END OF B.2 BSD 3-Clause license
END OF B.1 BSD 3-Clause license
==========================================================================
==========================================================================

View File

@@ -19,7 +19,7 @@ In order to use the image, it is necessary to accept the terms of the IBM MQ lic
* **LICENSE** - Set this to `accept` to agree to the MQ Advanced for Developers license. If you wish to see the license you can set this to `view`.
* **LANG** - Set this to the language you would like the license to be printed in.
* **MQ_QMGR_NAME** - Set this to the name you want your Queue Manager to be created with.
* **LOG_FORMAT** - Set this to change the format of the logs which are printed on the container's stdout. Set to "json" to use JSON format (JSON object per line); set to "simple" to use a simple human-readable. Defaults to "simple".
* **LOG_FORMAT** - Set this to change the format of the logs which are printed on the container's stdout. Set to "json" to use JSON format (JSON object per line); set to "basic" to use a simple human-readable. Defaults to "basic".
# Issues and contributions

View File

@@ -94,10 +94,10 @@ func configureLogger() (mirrorFunc, error) {
d := getDebug()
switch f {
case "json":
log = logger.NewLogger(os.Stdout, d, true)
log = logger.NewLogger(os.Stderr, d, true)
return log.LogDirect, nil
case "simple":
log = logger.NewLogger(os.Stdout, d, false)
case "basic":
log = logger.NewLogger(os.Stderr, d, false)
return func(msg string) {
// Parse the JSON message, and print a simplified version
var obj map[string]interface{}

View File

@@ -1,13 +0,0 @@
Alpha/experimental features
===========================
Use of the following environment variables is unsupported, and the features are subject to change without notice:
* **MQ_ALPHA_JSON_LOGS** - Set this to `true` or `1` to log in JSON format to stdout from the container.
* **MQ_ALPHA_MIRROR_ERROR_LOGS** - Set this to `true` or `1` to mirror the MQ error logs to the container's stdout
## Viewing the logs on the command line
The JSON-formatted logs are useful for forwarding to a log analysis system, but not very friendly when using `docker logs` or `kubectl logs`. You can format them using a command line utility like `jq`, for example:
```
docker run -e LICENSE=accept --rm -i -e MQ_QMGR_NAME=qm1 -e MQ_ALPHA_JSON_LOGS=1 mqadvanced-server:9.0.4.0-x86_64-ubuntu-16.04 2>&1 | jq -r '.ibm_datetime + " " + .message'
```