question: why are logs duplicated across/up levels?
See original GitHub issuePretty new to winston. Read through the docs, a little confused about the following:
Not sure if its just my config or if this is the expected behavior but when I log something using logger.error()
it’s logged to my info, debug and error log.
logger.info()
is logged to both info and debug.
logger.debug()
is logged to debug.
my config:
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)(),
new (winston.transports.File)({
name: 'error-file',
filename: 'jj-error.log',
level: 'error'
}),
new (winston.transports.File)({
name: 'info-file',
filename: 'jj-info.log',
level: 'info'
}),
new (winston.transports.File)({
name: 'debug-file',
filename: 'jj-debug.log',
level: 'debug'
})
]
});
for example:
logger.error('an error');
logger.info('some info');
logger.debug('useful info');
yields the following: jj-error.log:
{"level":"error","message":"an error"}
jj-info.log:
{"level":"error","message":"an error"}
{"level":"info","message":"some info"}
jj-debug.log:
{"level":"error","message":"an error"}
{"level":"info","message":"some info"}
{"level":"info","message":"some info"}
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Why getting duplicated log info when using django?
Both the handlers console (which handles logs of level >= INFO) and jenkins (which handles logs of level >= DEBUG) are handling your...
Read more >Preventing Duplicate Logs - New Relic Explorers Hub
Trimming duplicate logs doesn't seem like it should be based on a query, but rather an inbuilt feature of the Logs API/SDK. e.g....
Read more >duplicate log - Google Groups
I was wondering if anyone can tell me why my experiment is logging a duplicate of ... array so that one level stays...
Read more >At which level do duplicate rules work?
Yes, Duplicate Rules will block concurrent duplicates. The use of Duplicate Rules can cause some database contention, but prevents ...
Read more >Duplicate Log Entries In Windows Event Logs - TechNet
Usually we get multiple events. For example, if you open a document you are also viewing it so it will give you two...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this is how it was intended to work – when you increase log verbosity (e.g. to debug) you get more messages. If you want to around this you could create custom logger for different message types you want to log – bit excessive, but it does the job.
The appropriate configuration to customize this is
levels
, on the Logger instance.As specified in RFC 5424, the lower the number, the more important the message.
So everyone gets informed of an
error
. But hardly anyone needs to know aboutsilly
things.Using the configuration, you can reverse this order or do whatever you want, but you should follow the standard if you can.