Comments (17)
Some other loggers worth mentioning:
from jongo.
Should be added in v0.4 with an agnostic interface (eg. LogListener)
Eg.
class LogbackListener implements LogListener(){
Logger logger = LoggerFactory.getLogger(...);
void log(String message, Level level){
logger.debug(message);
}
}
...
new Jongo(..., new LogbackListener());
JUL can be a built-in implementation
from jongo.
Out of interested why not use slf4j-api and then have the actual loggin implementation provided ?
from jongo.
Well, this is a good question.
If a log framework is chosen instead of LogListener, it should definitely be SLF4J.
Nevertheless, since the beginging we are trying to minimize as far as we can project dependencies.
Jongo v0.1 and 0.2 have only one dependency : Jackson, v0.3 will have two : Jackson and Bson4jackson.
SLF4J is a transitive dependency of many other projects and here begin Maven version conflict hell.
Is LogListener interface not an elegant alternative to you ?
from jongo.
BTW, as JUL is the built-in JDK logging API, we could provide a JUL implementation of LogListener without any dependency
from jongo.
I see jongo as being used mainly on server side, so I don't think that having a reasonable number of well chosen dependencies will harm anyone. Furthermore, SLF4J-API has zero dependencies and is a more transparent approach than providing a custom LogListener which is a bit intrusive. I'm not a huge fan of JUL since it's environment is closed and I think logging merits an open source environment. Just a side note about Jackson, there seems to be a really nasty regression #113 so I hope jongo has a good testbed.
from jongo.
I'd rather there be no additional logging dependencies in Jongo. We are using log4j, and if you decide that Jongo uses SLF4J we'll have to add the SLF4J bridge, I think your existing callback solution is elegant and all that is required.
from jongo.
Right. If I'm using slf4j does this make the solution less elegant (if yes, to what degree?)? Or is it that as long as you are using log4j directly the solution remains elegant? If that's the case, let me know when you switch to another framework so that I can calibrate my watch. Say what is the problem with using a slf4j?
from jongo.
No, it's not less elegant. Using callback permit us to choose how to log and what framework to use. Another good star its to avoid maven dependencie hell :-)
from jongo.
Using slf4j-api also lets you choose the implementation that fits best for you, avoiding dependency hell. If you want to develop your own logging framework and come up with some super cool functionality then go ahead and simply implement an slf4j bridge. And if you do that maybe you can share your solution with the rest of the world and make it a better place for each and every one of us! :-)
from jongo.
@ihr Of course you could !!
Thanks for the joke
from jongo.
@geronimo-iia Glad to be of help!
from jongo.
Is this something that's still on any roadmap?
This is quite urgent, since we have no way to log which queries are performed. Any attempts to show mongo java driver logging, only show technical info, and no actual queries.
Any way to currently show queries is much appreciated.
from jongo.
For information, as of Mongo 3, its Java Driver supports logging with SLF4J, quite well configurable: http://mongodb.github.io/mongo-java-driver/3.2/driver/reference/management/logging/ . This probably makes this issue obsolete.
from jongo.
Configuring the mongodb logging will provide us with some logging:
19:09:39.283 DEBUG org.mongodb.driver.protocol.query - Sending query of namespace myapp.collection on connection [connectionId{localValue:2, serverValue:9446}] to server myserver:27017
19:09:39.328 DEBUG org.mongodb.driver.protocol.query - Query completed
But this does not show us which query was actually performed (query text).
from jongo.
Bump! As SanderDN mentions, the Mongo driver logging is entirely inadequate. It shows that a query was run, but not the interesting details about that query.
from jongo.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from jongo.
Related Issues (20)
- Add TravisCI build status on readme HOT 1
- [security] Upgrade Jackson Databind to 2.9.7 or higher HOT 2
- NPE when serialising root context HOT 1
- Reactive version? HOT 1
- Aggregation compatibility HOT 1
- Compatibility with latest mongo-java-driver HOT 3
- Any News? HOT 4
- Find query with field value containing a single quote not supported HOT 6
- How to get new JongoNative for Gradle? HOT 1
- generating and setting the id value of an annotated field should be moved to the ObjectIdUpdater HOT 4
- How to escape # in query HOT 2
- How to provide index hint for updating a document using update
- Deprecated method in the official documentation HOT 1
- All positional operator `$[]` throws `JsonParseException` in 1.5.0 HOT 4
- No updateMany() query HOT 1
- arrayFilters not working to update query in Kotlin
- Support for java 11 or higher HOT 1
- New CVE-2020-36518 (high) with jackson-databind HOT 2
- Is this project dead? HOT 1
- Escape `#`. `Not enough parameters passed to query` error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jongo.