[JAVA-2057] Custom logging implementation Created: 10/Dec/15 Updated: 08/Dec/17 Resolved: 08/Dec/17 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Monitoring |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | James Duong | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Description |
|
The Java driver currently assumes that logging will be done through SLF4J or java.util.logging. There doesn't appear to be a way to integrate the driver with a custom logging framework, making it difficult to integrate logging in middleware libraries that supply their own logging. The MongoDB C Driver allows for library users to specify logging callbacks. |
| Comments |
| Comment by Jeffrey Yemin [ 08/Dec/17 ] |
|
As there have been no other requests for this feature, and there are workarounds available (though none were seen as acceptable by the reporter), I'm closing this as Won't Fix. |
| Comment by Jeffrey Yemin [ 10/Dec/15 ] |
|
If SLF4J is not on the classpath, the driver defaults to JUL (java.util.logging), so it logs to wherever JUL is configured to log. There is no way to completely turn off logging except via configuration of the logging implementation itself. |
| Comment by James Duong [ 10/Dec/15 ] |
|
Hi Jeff, We won't be able to use solution 1, since we don't want to add an SLF4J dependency in our JDBC Driver (we wouldn't want to conflict with the calling application's version of SLF4J if it has one). Command Monitoring lloks like it might be a viable solution. In the meantime, is there an easy way to shut off logging in the 3.0.0 Driver, regardless of if SLF4J appears in the class path? It seems to log to STDERR by default. |
| Comment by Jeffrey Yemin [ 10/Dec/15 ] |
|
In that case, you have a couple of workarounds using the currently released driver
We will also consider your request to make logging pluggable. But note that the C driver does this because there is no equivalent to SLF4J in C. The whole point of SLF4J is so that every library doesn't have to invent its own pluggable logging API. |
| Comment by James Duong [ 10/Dec/15 ] |
|
Hi Jeff, We are using our own SDK to build a JDBC driver on top of the Mongo Java Driver. It has its own logging API that isn't tied to SL4J or java.util.logging. |
| Comment by Jeffrey Yemin [ 10/Dec/15 ] |
|
Hi James, Can you tell me what middleware libraries you'd like to integrate with? |
| Comment by James Duong [ 10/Dec/15 ] |
|
This was encountered in the 3.0.0 build. |