-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
errorLogger when metaField=nulll #236
Comments
That causes the log metadata to be placed at the root of the log entry (see the read me) but depending on the transports you're using, this might not be what you want. What is the rest of your configuration? |
hi, The rest of configuration, json format, console and kafka transports. |
The kafka transport expects log messages to have the metadata of the log messages at the "meta" property of the log entry (the default behavior of express-winston when you don't set the metaField). By setting the "metaField" to null you put it at the root of the log entry (see the readme of express-winston for the use of this field) and would be ignored by kafka. This is used for other transports like the Stackdriver transport which expect additional metadata to be at the root of the log entry. Why are you setting it to null? |
Strange! the kafka transport does pick up the messages cleanly without meta
(i.e. from root message) in case of req/resp logger. Whereas the error
logger does not log full details/meta fields when metaField=null.
I just wanted to have things less nested when received in ELK to match the
pattern with other winston logs which are without meta
Best Regards,
Jehanzeb Qayyum
+971 52 898 2285
…On Sun, 1 Mar 2020 at 22:01, Matthew Morrissette ***@***.***> wrote:
The kafka transport expects log messages to have the metadata of the log
messages at the "meta" property of the log entry (the default behavior of
express-winston when you don't set the metaField). By setting the
"metaField" to null you put it at the root of the log entry (see the readme
of express-winston for the use of this field) and would be ignored by
kafka. Why are you setting it to null?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#236?email_source=notifications&email_token=ABJV6SWONMWHRKRUPNGMYJDRFKPHDA5CNFSM4K3BPMXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENNGDIA#issuecomment-593125792>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJV6SSQBMQRTZOY7JDZR6TRFKPHDANCNFSM4K3BPMXA>
.
|
Hmmm well I might be wrong then. That seems very odd behavior to me, but I can't see any difference in the coding of the metadata mapping for errors vs normal request logging. Without more detailed information about your configuration and examples of how it's logging, I don't know how I can help you anymore. |
|
If you remove the metaField from the errorLogger (like you have it), do you start to get metadata under the "meta" field? Do you have an example? I'm reading through the code and I can't find anything that varies between the two. |
as of now i commented metaField: null, and its logging the error stats/details under meta. If i un-comment it will not log an error entry . I will post the 2 example logs (with/without metaField=null). |
Without metaField=null With metaField=null
As you notice the error logger did not log anything in 2nd case |
any update on this? Same issue |
same issue for me |
Ok I have found the issue, and a fix, but not the reason. lets begin with the fix:
My investigation so far (which I am gonna drop cause this is good enough for me): Q: Is it the key or the value that is the problem? Let me elaborate on the last answer I have tried the following with a custom error-extractor:
So assuming you do not need the specific |
The errorLogger does not log anything when metaField is set to null.
app.use(
expressWinston.errorLogger({
winstonInstance: logger,
metaField: null
})
);
The text was updated successfully, but these errors were encountered: