Skip to content

Don't log warnings on literal null parameters. #2277

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

Closed
mdelmoral opened this issue Jun 2, 2021 · 2 comments
Closed

Don't log warnings on literal null parameters. #2277

mdelmoral opened this issue Jun 2, 2021 · 2 comments
Assignees
Labels
type: enhancement A general enhancement

Comments

@mdelmoral
Copy link

First of all, this is not a bug.

In the class Neo4jQuerySupport is the next line:

REPOSITORY_QUERY_LOG.warn("Do not use `null` as a property value for comparison."					
+ " It will always be false and return an empty result.");

This warning is triggered every time that the query has a null parameter. Even when these parameters are to set a null value in a property.
I have a @Query when $result can be null. This query is executed 200k/day so you can imagine my log file 😅
SET rel.teamId = $teamId, rel.result = $result

Today, I have two workarounds:

  • Configure the logs to exclude Neo4jQuerySupport warnings.
  • Create an alternative @Query with SET rel.teamId = $teamId in the cases the $result is null.

But I ask myself if this warning makes sense. When you're writing a query, it's assumed that you have to test it.

Thanks!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 2, 2021
@meistermeier
Copy link
Collaborator

Thanks for reporting this.
At least at the moment I am with you. There does not really seem to be a warning needed.
Since we do want to log that there is something noticeable going on, that might be unintended, we should change the log level here.

@michael-simons michael-simons self-assigned this Jun 7, 2021
@meistermeier meistermeier added the type: enhancement A general enhancement label Jun 7, 2021
@michael-simons michael-simons removed the status: waiting-for-triage An issue we've not yet triaged label Jun 7, 2021
@michael-simons michael-simons changed the title Is a warning necessary? False positive warning Don't log warnings on literal null parameters. Jun 7, 2021
michael-simons added a commit that referenced this issue Jun 7, 2021
This changes the log level to `debug` for literal null parameters and
also improves the wording around it.

In addition, a TODO has been removed:

- It doesn't make sense to move the conversion of RANGE etc. to the
  conversion service, as those will be converted to maps etc. which are
  subject to further conversion anyway

This fixes #2277.
@michael-simons michael-simons added this to the 6.0.10 (2020.0.10) milestone Jun 7, 2021
@michael-simons
Copy link
Collaborator

Log level will be debug from 6.0.10 onwards.

michael-simons added a commit that referenced this issue Jun 7, 2021
This changes the log level to `debug` for literal null parameters and
also improves the wording around it.

In addition, a TODO has been removed:

- It doesn't make sense to move the conversion of RANGE etc. to the
  conversion service, as those will be converted to maps etc. which are
  subject to further conversion anyway

This fixes #2277.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants