-
Notifications
You must be signed in to change notification settings - Fork 47
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
Raw Queries and Results #272
Comments
Turn logging on the "Couchbase.Linq" namespace up to the debug level and it will log the queries as they are executed. |
There's really no way to get it from the query? I need to correlate it to other data in the application and send it off to application insights. The app processes many millions of requests per day, so it's very hard to deal with debug logs. How can I simulate what the debug logs are doing? |
Unfortunately, no there isn't a good way currently. As I recall, I looked at making ToString work before but there were some concerns/difficulties, though I don't remember what they were anymore. Also, performance could be a bit of an issue, as this would trigger expression tree parsing and query rendering twice (unless we also adding some kind of caching to the IQueryable instance). The best recommendation that I have for you is that the logging infrastructure used by the Couchbase SDK, and consequently Linq2Couchbase, is injectable. You could inject an interception layer that would pick out the query text from the logs before output. Finally, I would strongly recommend looking into security concerns around leaving this on in production. There will potentially be sensitive data included in the query text, I think logging all queries in production is generally considered an anti-pattern for that reason. It could potentially be mitigated with parameterization, but that isn't something that Linq2Couchbase does. |
Alright, that's a shame. I've actually already turned on logging to inspect the queries. It was too hard to parse the signal from the noise. In regards to performance, this isn't something I'd need to do for every query, just the exceptions. So I'm not sure that performance is an issue. People can opt into the performance hit by calling ToString. Is there any way to read the raw response from Couchbase before it is parsed? I'm getting a ParseResult exception, so it would be super useful to be able to see the result that isn't being parsed correctly. |
I'm trying to debug an application and I'm having some trouble. I'm executing a query that is throwing a parse result. I'd like to see the query that is being generated and the result that is being returned. If I can access the raw query, I can execute it against the database.
I can't figure out how to generate a string version of the Couchbase query from the IQueryable instance. ToString usually generates the raw query in other Linq implementations that I've worked on, but it doesn't seem to do that here.
The text was updated successfully, but these errors were encountered: