• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FIWARE / trusted-issuers-list / 98

01 Oct 2026 10:15AM UTC coverage: 87.67% (+0.02%) from 87.654%
98

Pull #29

github

vramperez
Log every rejected request with its reason

Requests micronaut rejects itself with 400 (malformed JSON, missing body or
query value, a body that cannot be converted) were only visible in the request
log, without any reason. They are now logged like the other invalid requests,
at WARN with the reason and stack trace. RejectedRequestLogging wraps
micronaut's own handlers, so the responses stay the same.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Pull Request #29: Make log output configurable and log every request

160 of 207 branches covered (77.29%)

Branch coverage included in aggregate %.

47 of 58 new or added lines in 11 files covered. (81.03%)

1 existing line in 1 file now uncovered.

679 of 750 relevant lines covered (90.53%)

0.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/org/fiware/iam/Application.java
1
/*
2
 * Copyright 2023 FIWARE Foundation e.V. and/or its affiliates
3
 * and other contributors as indicated by the @author tags.
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
package org.fiware.iam;
18

19
import io.micronaut.runtime.Micronaut;
20
import java.util.Map;
21
import liquibase.Scope;
22
import liquibase.ui.LoggerUIService;
23
import org.slf4j.bridge.SLF4JBridgeHandler;
24

25
public class Application {
×
26

27
  /** Liquibase setting that decides where the update summary is written to. */
28
  private static final String LIQUIBASE_SUMMARY_OUTPUT = "liquibase.command.showSummaryOutput";
29

30
  /** Write the update summary to the log instead of stdout. */
31
  private static final String LIQUIBASE_SUMMARY_TO_LOG = "LOG";
32

33
  /** Environment variable selecting the log output, see logback.xml. */
34
  private static final String LOG_FORMAT = "LOG_FORMAT";
35

36
  /** Log output as one JSON object per line. */
37
  private static final String LOG_FORMAT_JSON = "JSON";
38

39
  public static void main(String[] args) throws Exception {
40

41
    SLF4JBridgeHandler.removeHandlersForRootLogger();
×
42
    SLF4JBridgeHandler.install();
×
43

44
    // liquibase prints the applied change sets and its update summary directly to stdout, bypassing
45
    // the log format (and breaking JSON output). Both are routed through the "liquibase" logger
46
    // instead: the migrations run on this thread during startup, so a scope with a logging UI
47
    // applies to them. An explicitly configured summary output is kept.
NEW
48
    Scope.enter(Map.of(Scope.Attr.ui.name(), new LoggerUIService()));
×
NEW
49
    if (System.getProperty(LIQUIBASE_SUMMARY_OUTPUT) == null) {
×
NEW
50
      System.setProperty(LIQUIBASE_SUMMARY_OUTPUT, LIQUIBASE_SUMMARY_TO_LOG);
×
51
    }
52

53
    // the ascii banner would be the only output that is not a JSON line
NEW
54
    boolean jsonLogging = LOG_FORMAT_JSON.equalsIgnoreCase(System.getenv(LOG_FORMAT));
×
NEW
55
    Micronaut.build(args).mainClass(Application.class).banner(!jsonLogging).start();
×
UNCOV
56
  }
×
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc