1

So, I'm making a java app using the Google Cloud Vision API and the method is returning many DEBUG logs to my console. I would like to disable them, but I don't know how. I'm getting this output https://pastebin.com/gVVJprhV

This is my code

public String googleapi(String image) throws IOException, Exception {

        List<AnnotateImageRequest> requests = new ArrayList<>();

        ByteString imgBytes = ByteString.readFrom(new FileInputStream(image));

        Image img = Image.newBuilder().setContent(imgBytes).build();
        Feature feat = Feature.newBuilder().setType(Type.TEXT_DETECTION).build();
        AnnotateImageRequest request =
                AnnotateImageRequest.newBuilder().addFeatures(feat).setImage(img).build();
        requests.add(request);

        String question = null;

        try (ImageAnnotatorClient client = ImageAnnotatorClient.create()) {
            BatchAnnotateImagesResponse response = client.batchAnnotateImages(requests);
            List<AnnotateImageResponse> responses = response.getResponsesList();

            for (AnnotateImageResponse res : responses) {
                if (res.hasError()) {
                    //System.out.printf("Error: %s\n", res.getError().getMessage());
                    System.out.println("Se ta bom, n mexas");
                    return null;
                }

                EntityAnnotation annotation = res.getTextAnnotations(0);
                question = annotation.getDescription();
                question = question.replaceAll("\n", " ");
            }

        }
        return question;
    }

I don't know why it's throwing out all this debug, but I would like to disable it. Thanks in advance.

1 Answers1

0

You can create exclusion filters to filter out ‘Debug’ logs in Stackdriver for an instance of your application. Stackdriver saves various logs and are categorized into Critical, Error, Warning, Info and Debug. If you do not want the debug logs, you can exclude them so they are not created. You also have the option to set a percentage so that the selected percentage will be excluded. The document provides instructions on how to create exclusion filter for logs [1].

[1] https://cloud.google.com/logging/docs/exclusions#exclusion-filters