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

Doubt about conditional usage. #411

Closed
mcezzare opened this issue Jan 18, 2019 · 1 comment
Closed

Doubt about conditional usage. #411

mcezzare opened this issue Jan 18, 2019 · 1 comment

Comments

@mcezzare
Copy link

Hy, in first place Great project.
I am trying to use this package in and spring boot rest api and without any filters it's working fine , logging all requests and responses. But I am using the actuator package and I want to exclude this requests from logs.
I am trying to use the conditional example as described in the README

package com.***.application;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.zalando.logbook.Logbook;

import static org.zalando.logbook.Conditions.requestTo;

@SpringBootApplication(scanBasePackages = {"com.***.application"})
public class Application {

    public static void main(String[] args) {
//        Logbook logbook = Logbook.create(); // this works fine, filters on app.properties
        Logbook logbook = Logbook.builder()
                .condition(exclude(
                        requestTo("/actuator/**")))
                .build();

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

but I am getting this error:

application/Application.java:15: error: cannot find symbol
.condition(exclude(
^
symbol: method exclude(Predicate)
location: class Application
1 error
:compileJava FAILED

Please what is missing to use the exclude keyword ?
Thanks

@whiskeysierra
Copy link
Collaborator

It's a static import. Just let your IDE's autocomplete feature suggest it for you. If you want to write the import by hand: import static org.zalando.logbook.Conditions.exclude.

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