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

Add support for providing a custom layout during logging bootstrap #2260

Merged
merged 1 commit into from Feb 8, 2018

Conversation

Projects
None yet
3 participants
@arteam
Member

arteam commented Feb 8, 2018

Problem:

Dropwizard users have the ability to configure their application to use JSON as the logging format. Unfortunately, the default logging bootstrap mechanism which kicks off before Dropwizard logging
configuration, uses the default logging layout. As a result, some internal logging messages (Jetty, Hibernate initialization) are produced in a not recognized format.

Solution:

This change add possibility to specify a layout factory during the bootstrap process. Users can override the bootstrap method of Application and provide an own layout format. For example,

BootstrapLogging.bootstrap(Level.INFO, new EventJsonLayoutBaseFactory());
Result:

As a result, the all applications logs will produced in the JSON format.
Resolves #2250

Add support for providing a custom layout during logging bootstrap
Dropwizard users have the ability to configure their application to
use JSON as the logging format. Unfortunately, the default logging
bootstrap mechanism which kicks off before Dropwizard logging
configuration, uses the default logging layout. As a result, some
internal logging messages (Jetty, Hibernate initialization) are
produced in a not recognized format.

This change add possibility to specify a layout factory during
the bootstrap process. Users can override the bootstrap method of
`Application` and provide an own layout format. For example,

```
BootstrapLogging.bootstrap(Level.INFO, new EventJsonLayoutBaseFactory());
```

As a result, the all applications logs will produced in the JSON format.

@arteam arteam force-pushed the boostrap-layout-factory branch from 921588a to b3beebd Feb 8, 2018

@jplock jplock added this to the 1.3.0 milestone Feb 8, 2018

@jplock jplock added the bug label Feb 8, 2018

@jplock

jplock approved these changes Feb 8, 2018

@jplock jplock merged commit 3f9cf22 into master Feb 8, 2018

5 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@jplock jplock deleted the boostrap-layout-factory branch Feb 8, 2018

@li-a

This comment has been minimized.

li-a commented Oct 12, 2018

This also gives us an easier way to change just the layout in order to change exceptions back to the standard Logback format (prefixed w/ tab, no more exclamation points). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment