arangodb / arangodb-java-driver

The official ArangoDB Java driver.
Apache License 2.0
202 stars 94 forks source link

Easy way to show only query on debugger log #350

Open giovanniac opened 4 years ago

giovanniac commented 4 years ago

I have a situation where I want to activate only the query debug logger while I set up the driver builder. The debug log output that I want to activate is shown in line 135 here:

https://github.com/arangodb/arangodb-java-driver/blob/71fb190ba316f3c618514633fd51e2101a95756e/src/main/java/com/arangodb/internal/velocystream/VstCommunicationSync.java

It would be interesting to have an easy way to access this option for future troubleshooting and to have a better and more transparent point of view of what query is being builded up while developing.

Thanks for the help!

rashtao commented 4 years ago

You can enable debug level for such logger adding the following to your logback.xml:

    <logger name="com.arangodb.internal.velocystream.VstCommunicationSync" level="debug"/>

Additionally you might want to filter the logged rows using Logback filters: http://logback.qos.ch/manual/filters.html

PauloFerreira25 commented 4 years ago

Problems with this approach:

1) The log is by class and not by function. If someone ever puts another log in this class, something that does not mean that it is the query will come out.

2) when the driver proves to be "professional". Having a flag that turns a driver function on or off is much more professional than simply turning on a debug. You put in the driver's documentation that this parameter exists, it is quite different from what you put in that the way to use it is to turn on the debugging of an "unknown" class.

rashtao commented 4 years ago

Thanks for sharing, we will consider the possibility to implement logging categories in future versions.