Comments (2)
Hi @JamesBoon. The config overrides only accept simple string values and arrays of strings. Hence, they cannot be used to override the whole appenders object.
The filter factories also work for other commands since they reside in dropwizard-logging
and don't depend on any logic related to the server command. The docs only provide an example for a FilterFactory<IAccessEvent>
that is indeed only related to request logging within the server command. To obtain a filter factory for a "normal" appender rather than a request log appender, you'll need to provide a FilterFactory<ILoggingEvent>
.
I think the simplest solution for your use case is to use environment variables for the logging levels of the appenders. Then you can provide an environment variable with the value OFF
to disable logging for the other appenders.
from dropwizard.
Thank you @zUniQueX, that was the hint I needed!
If anyone else needs it:
appenders:
- type: console
threshold: ${DW_LOG_THRESHOLD_CONSOLE:-OFF}
# ...
- type: file
threshold: ${DW_LOG_THRESHOLD_FILE:-INFO}
# ...
This way, the console logger is OFF
by default, but can be switched on by setting the environment variable DW_LOG_THRESHOLD_CONSOLE
to any log level like e.g. INFO
.
The file logger is on by default and can be switched off by setting DW_LOG_THRESHOLD_FILE=OFF
.
Just before anybody asks, yes the same thing can be achieved via passing system properties. But this should only be used if the number and order of the log appenders is always fixed!
-Ddw.logging.appenders[0].threshold=INFO -Ddw.logging.appenders[1].threshold=OFF
from dropwizard.
Related Issues (20)
- Vulnerability issues with dependencies in dropwizard 4.0.1 HOT 1
- IlligalAccesException : module com.fasterxml.jackson.module.blackbird does not read module *** HOT 12
- Incorrect javadocs for io.dropwizard.logging.common.AppenderFactory
- Dropwizard 4.0.3 not logging request logs HOT 2
- AWS Serverless Example HOT 1
- Dropwizard 4.0.2 + Hibernate + ContainerResponseFilter with NameBinding HOT 3
- Jersey client 2.21 doesnt support Transfer-encoding: chunked, is there any workaround?
- Breaking change in a version between 4.0.1 and 4.0.4 HOT 3
- DropwizardJettyServerAdapter in DropWizard3 causing exception when there are multiple HttpHeaders HOT 9
- Update Logback to fix CVE-2023-6378? HOT 4
- NPE in tests when a factory is used to inject a value to a resource method parameter HOT 2
- Managed virtual thread pool HOT 2
- Deserialization failures due to Afterburner HOT 1
- Server starts and stops immediately when both enableVirtualThreads and enableAdminVirtualThreads are set to true HOT 5
- delay between tests that use DropwizardExtensionsSupport HOT 2
- Logging request and response body with RequestLogFactory HOT 2
- Dependency Injection issue in AuthFilter HOT 4
- Add cache support for stale-while-revalidate HOT 1
- Enhancement: Make Cli ArgumentParsers locale configurable HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dropwizard.