Skip to content
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

Renaming MDC field #403

Closed
mathewsreji opened this issue May 6, 2020 · 1 comment
Closed

Renaming MDC field #403

mathewsreji opened this issue May 6, 2020 · 1 comment
Milestone

Comments

@mathewsreji
Copy link

mathewsreji commented May 6, 2020

I am trying to plug in the encoder with a java app which uses apache camel framework. The framework already has some inbuilt MDC information as shown here -> https://people.apache.org/~dkulp/camel/mdc-logging.html

I want to rename certain fields in the log output. For example, instead of following

{"application_name":"roma-runtime","timestamp":"2020-05-06T13:48:16.366Z","logger":"org.apache.camel.impl.DefaultCamelContext","level":"INFO","class":"org.apache.camel.impl.DefaultCamelContext","method":"start","file":"DefaultCamelContext.java","line":3186,"thread":"http-nio-8888-exec-3","camel.contextId":"53081f9c-6d51-4f98-8c9d-439de1fcd1db","message":"Total 3 routes, of which 3 are started"}

I want camel.contextId to be renamed to integration_id. as follows

{"application_name":"roma-runtime","timestamp":"2020-05-06T13:48:16.366Z","logger":"org.apache.camel.impl.DefaultCamelContext","level":"INFO","class":"org.apache.camel.impl.DefaultCamelContext","method":"start","file":"DefaultCamelContext.java","line":3186,"thread":"http-nio-8888-exec-3","integration_id":"53081f9c-6d51-4f98-8c9d-439de1fcd1db","message":"Total 3 routes, of which 3 are started"}

Is there a way I can configure this name mapping in my logback-spring.xml file?

@philsttr
Copy link
Collaborator

I've added support for this in the next version.

If you need something before the next version is released, you can disable writing the MDC, and add your own custom JsonProvider that outputs the MDC using custom field names.

@philsttr philsttr added this to the 6.4 milestone May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants