Addressing the system.out lines throughout the project.#121
Addressing the system.out lines throughout the project.#121wjonassen merged 5 commits intoopendcs:mainfrom
Conversation
…one system.out to a throw. Also, removing unused imports.
Also, renamed mapper in the function to remove confusion with the class variable.
opendcs-rest-api/src/main/java/org/opendcs/odcsapi/res/ObjectMapperContextResolver.java
Outdated
Show resolved
Hide resolved
…in ApiBasicClient.java with LOGGER.debug.
opendcs-rest-api/src/main/java/org/opendcs/odcsapi/appmon/ApiEventClient.java
Show resolved
Hide resolved
opendcs-rest-api/src/main/java/org/opendcs/odcsapi/appmon/ApiEventClient.java
Show resolved
Hide resolved
This is a decent amount of them, but getting these changes out now to get some review on them before continuing down the path of doing them all. Some system.out's are removed, some have been converted to slf4j logging. Others are converted into throws.
|
@MikeNeilson I have addressed a bunch of the system.out's in this. There are still more, but if you could go through some of the changes to make sure I'm addressing them appropriately, I can then finish off the rest of them. I am removing the ones where they really shouldn't be there, converting some to slf4j logging, and converting some to thrown exceptions. |
MikeNeilson
left a comment
There was a problem hiding this comment.
Looks like a reasonable start to me.
Ok, sounds good. I will address the rest of the system.out's and 'undraft' this PR. |
This is a decent amount of them, but getting these changes out now to get some review on them before continuing down the path of doing them all. Some system.out's are removed, some have been converted to slf4j logging. Others are converted into throws.
|
| { | ||
| Logger.getLogger(ApiConstants.loggerName).info("PropSpecHelper.getPropSpecs class='" + className + "'"); | ||
| //className is user controlled, so it is logged at trace level. | ||
| LOGGER.trace("PropSpecHelper.getPropSpecs class='{}'", className); |
Check notice
Code scanning / SonarCloud
Logging should not be vulnerable to injection attacks
| } | ||
|
|
||
| System.out.println(String.format("API Param String: %s", paramString)); | ||
| LOGGER.debug("API Param String: {}", paramString); |
Check notice
Code scanning / SonarCloud
Logging should not be vulnerable to injection attacks
@MikeNeilson I know you did approve this yesterday, but I have just added the rest of the updates for addressing the system.out's and don't want to merge until the new changes are approved (or updates are needed). |

Problem Description
There are system.out's in the project. We want to either remove them completely (if they are not useful), or replace those with SLF4J in the case that they are useful.
Fixes #79.
Solution
In the cases where it's a system.out that's not useful (maybe it's a debug line), remove it completely. If it is useful, then convert it into slf4j.
how you tested the change
Verify the project builds.
Where the following done:
(Formerly called regression tests.)