Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
425 views
in Technique[技术] by (71.8m points)

我这个MongoDB的日志怎么感觉不太对?

刚刚学习安装了MongoDB,版本4.4.0 ;然后成功启动后访问
http://localhost:27017/ 显示

It looks like you are trying to access MongoDB over HTTP on the native driver port.

控制台的日志怎么感觉不太对啊? 我看别人的日志不是这样的,我这个怎么是json格式的字符串?

{"t":{"$date":"2020-08-20T19:58:00.210+08:00"},"s":"W",  "c":"CONTROL",  "id":20698,   "ctx":"main","msg":"***** SERVER RESTARTED *****","tags":["startupWarnings"]}
{"t":{"$date":"2020-08-20T19:58:00.212+08:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2020-08-20T20:31:27.953+08:00"},"s":"I",  "c":"CONTROL",  "id":23138,   "ctx":"consoleTerminate","msg":"Shutting down","attr":{"exitCode":12}}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

真的是版本问题,4.4.0日志格式都变了,下个了mongodb-4.0.19 试了一下,果然是,这是4.0.19的日志。。 太坑了

2020-08-21T19:50:05.220+0800 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'

补充:
看了4.4.0 的版本说明,新出了个结构化日志
详解见官网说明

下面是原文

Structured Logging

Starting in MongoDB 4.4, mongod / mongos instances now output all log messages in structured JSON format. This includes log output sent to the file, syslog, and stdout (standard out) log destinations, as well as the output of the getLog command.

Previously, log entries were output as plaintext.

If you have existing log parsing utilities, or use a log ingestion service, you may need to reconfigure these tools for the new structured logging format with MongoDB 4.4.

See Log Messages for a detailed examination of the new structured logging format, including examples of log parsing using the new log structure.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...