Skip to content

Log arguments along with query #1311

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
JesusTheHun opened this issue Jan 26, 2022 · 4 comments
Closed

Log arguments along with query #1311

JesusTheHun opened this issue Jan 26, 2022 · 4 comments
Labels
type: enhancement A general enhancement

Comments

@JesusTheHun
Copy link

I expect this log level to display all queries that are executed :

logging:
    level:
        org.springframework.data.couchbase.repository.query: TRACE

The closest we get is with org/springframework/data/couchbase/repository/query/StringBasedCouchbaseQuery.java :

		if (LOG.isDebugEnabled()) {
			LOG.debug("Created query " + query.export());
		}

But query.export() returns an empty string.

Expected output : the query itself + the parameters used for that execution.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 26, 2022
@mikereiche
Copy link
Collaborator

Should be logged in the all() method of Reactive*OperationSupport by the org.springframework.data.couchbase.core logger. The arguments aren't logged.

	public Flux<T> all() {
		PseudoArgs<QueryOptions> pArgs = new PseudoArgs(template, scope, collection, options, domainType);
		String statement = assembleEntityQuery(false, distinctFields, pArgs.getCollection());
		LOG.trace("findByQuery {} statement: {}", pArgs, statement);

@mikereiche mikereiche added status: feedback-provided Feedback has been provided and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 26, 2022
@JesusTheHun
Copy link
Author

Any chance we can have the arguments along the query ?

@mikereiche mikereiche added type: enhancement A general enhancement and removed status: feedback-provided Feedback has been provided labels Feb 1, 2022
@mikereiche mikereiche added this to the 5.0 M2 (2022.0.0) milestone Feb 1, 2022
@mikereiche mikereiche changed the title Log trace missing the query itself Log arguments along with query Feb 1, 2022
mikereiche added a commit that referenced this issue Feb 1, 2022
@mikereiche
Copy link
Collaborator

Ignore the commit/pull request related to CasMismatch. It referenced the wrong issue - should have referenced #1314.

@mikereiche
Copy link
Collaborator

The arguments are already logged by OptionsBuilder.buildXXXOptions(). They should appear in the log immediately after the LOG.trace("findByQuery {} statement: {}", pArgs, statement) output

	if (LOG.isTraceEnabled()) {
		LOG.trace("query options: {}", getQueryOpts(options.build()));
	}

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

3 participants