-
Notifications
You must be signed in to change notification settings - Fork 11
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
Logs are all sent to stderr #98
Comments
@AntoineAugusti I looked at the logging implementation in the project and it seems like the log statements are sent to the appropriate channel. For example, looking at Main.java for the batch processor: try {
List<IterationStatistics> stats = processor.processFeeds();
if (returnStats) {
_log.info("-------------------------");
_log.info(" Validation Statistics");
_log.info("-------------------------");
for (IterationStatistics stat : stats) {
_log.info(stat.toString());
}
}
} catch (IOException | NoSuchAlgorithmException e) {
_log.error("Error running batch processor: " + e);
} This is what I would expect, as the Did you find specific examples you could share where you noticed the issue? Am I missing something when I look at the code? |
@AntoineAugusti Actually, I think I see what you're saying now. Here's the output from IntelliJ: It looks like even though we're specifying the different logging levels within the application (which is why we see the From a quick look I'm not sure it's possible to split I do recall us having issues with slf4j previously:
IIRC it took some work to get the underlying components like the onebusaway-gtfs-modules and Hibernate to all be configured and output logs using the same framework. Some config info is here: The gtfs-validator is using Flogger: ...so it might be useful to switch to Flogger here too. LogBack also seems like a useful alternative: ...although if the goal is output split between System.out and System.err we should make sure those frameworks are capable of that functionality, and that they play nicely with the logging in other libraries used in the validator. Both Flogger and Logback seem to support SLF4j. Here's the config for Flogger: @AntoineAugusti Could you say more about your use case of splitting between System.out and System.err? Is this preventing you from sending logs to the right places in your deployment of the batch validator? |
Exactly, this is why I opened this issue. Logs have different levels but they are all sent to stderr.
When an error occurs during validation, we would like to display only errors to the end-user and not info logs. At the moment we are forced to display the full stack trace (validator starting up, executing and then error messages) because logs are not sent to stdout and stderr. |
Issue by AntoineAugusti
Feb 22, 2022
Originally opened as CUTR-at-USF#413
Summary:
When running the program on the CLI in batch mode, all logs are sent to stderr even without errors.
Steps to reproduce:
Run a command like
java -jar /usr/local/bin/gtfs-realtime-validator-lib-1.0.0-SNAPSHOT.jar -gtfs file.zip -gtfsRealtimePath /tmp/path
Expected behavior:
Logs should be logged to stdout and errors should be logged to stderr
Observed behavior:
All logs, including info are sent to stderr.
This is the default behaviour of this library https://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html
Platform:
macOS
JDK 8
The text was updated successfully, but these errors were encountered: