-
Notifications
You must be signed in to change notification settings - Fork 454
Improve logging system #2148
Comments
Logger choices
|
Another popular option: https://github.com/visionmedia/debug |
@willclarktech this |
yes debug more of real debugging tool, where we want is logging. |
When it comes to Deep Nested Objects Bunyan is the fastest even in their benchmarks. I believe our logging will grow to deep level objects, so we should prefer Bunyan over Pino. Fir Watson I didn't have extensive experience, a quick look told that the profiler feature is pretty basic, so not useful for us. Rest is quite similar to Bunyan, naming conventions and approach to initializing is different. Bunyan have a concept of child logger that I believe can be much useful in our case. Where each module can have its on child logger adding more data attributes to main logger. |
yea,
I was thinking we just need |
Log levels
FormatRequired
Example
ResultConsole output
File output
|
I don't really like the format. |
@4miners can you elaborate more? |
While it makes automatic parsing of logs simpler (for KPIs or whatever) it makes reading the logs more difficult. Fox example it will be harder to see actual timestamp when |
@4miners When we have raw log data in a structured format. We can decide on however to print it in console to make it to looks pretty. |
As @nazarhussain says, output for console is configurable, so i can fix it pretty quick. For the
Also, kind of |
I prefer to have a detail log record. Its up to us how much detail we should show in console, but we must have all those details in file. This will give us flexibility while we want to do some analysis on top of logs. {
// in case of multiple log files
"name": "log_name",
// This is must to have when put big log files into some log analysis
// and want to search specific behavior on certain node
"hostname": "banana.local",
// log level
"level": 3,
// A string based message if provided a string to log otherwise blank string
"msg": "start request",
// Time of log entry in UTC format
"time": "2012-02-03T19:02:57.534Z",
// A snapshot for blockchain information will be useful
// When we want to get all logs happens for particular block height
"blockchain": {
"height": "12345"
"blockId": "7899584854854"
},
// Particular module which triggers this log entry
"module": "peers",
// A json object for additional data related to that particular log object
"meta": { }
} If you look closely only
Block height and block id is more integral key points which we always used for debugging. We can enrich our logs further but in first iterations converting those to |
I agree overall. |
Will produce
JSON
|
@shuse2 I did some benchmarks based on our requirmenets and our implementation; Here are the simple logging objects; // String
logger.debug('Block was forged with the the given length.')
// Simple Object
logger.debug('Given transaction with was invalid in the block', {blockId: '11111111', transactionId: '22222222222222', height: 2});
// Deep Object
logger.debug('Request you just made had invalid properties', {
blockId: '11111111', transactionId: '22222222222222',
req: {
remoteAddress: '1289.988.908',
method: 'GET',
url: '/api/transactions',
queryString: {
transactionId: '11334455555',
sort: 'rank:asc'
},
headers: {'X-Forwarded-For': '123.144.449.9988'},
etag: '111888888999999999'}}); Here are the results;
From the benchmarks I notice NOTE: These benchmarks are only for file based logging not the console. |
Thanks @nazarhussain, good experiment! |
Replace logger with bunyan - Closes #2148
Description
Currently, logging does not have standard and outputted in text format.
It is hard to use for analysis of KPI.
Expected
Which version(s) does this affect? (Environment, OS, etc...)
1.0
The text was updated successfully, but these errors were encountered: