Skip to content

Configuration

Donát Csongor edited this page Sep 1, 2022 · 2 revisions

Default parameters

Recommend: If you would like to change the default values, you have to set them before your project starts. Example:

@SpringBootApplication
public class DemoApplication {
    public static void main(String[] args) {
        // HERE

        SpringApplication.run(DemoApplication.class, args);
    }
}

MDC Context Key

Since ThreadLocal is not used (see Home page), the MDC data to be logged is found in the reactor context, and we have to separate it. It would help if you found a non-used key name that will represent the MDC scope in the reactor context.

By default, this key value is "DEFAULT_REACTOR_CONTEXT_MDC_KEY"

You can modify this key via the Configuration class. All components will default use this key unless you set another one. See: link place

// Kotlin
fun main() {
    Configuration.defaultReactorContextMdcKey = "another-non-used-key"
    // ...
}
// Java
public void main(String[] args) {
    Configuration.INSTANCE.setDefaultReactorContextMdcKey("another-non-used-key");
    // ...
}

Processing scheduler

We are in a reactor environment, so the processing also takes place in a reactor environment regardless of whether we want to log from the reactor or coroutine. So, the logging process is controlled by scheduler, and the default scheduler is boundedElastic.

You can modify this scheduler via the Configuration class. All components will default use this key unless you set another one. See: link place

Connoisseurs can find it here: io.github.numichi.reactive.logger.reactor.IReactorCore#wrap

// Kotlin
fun main() {
    Configuration.defaultScheduler = Schedulers.boundedElastic() // direct or custom
    // or
    Configuration.defaultScheduler = SchedulerOptions.BOUNDED_ELASTIC // by ENUM
    // ...
}
// Java
public void main(String[] args) {
    Configuration.INSTANCE.setDefaultScheduler(Schedulers.boundedElastic()); // direct or custom
    // or
    Configuration.INSTANCE.setDefaultScheduler(SchedulerOptions.BOUNDED_ELASTIC); // by ENUM

    // ...
}

Hook (from v3.0.0)

writing

Clone this wiki locally