Coder Social home page Coder Social logo

Add logs about jongo HOT 17 CLOSED

bguerout avatar bguerout commented on June 28, 2024
Add logs

from jongo.

Comments (17)

ihr avatar ihr commented on June 28, 2024

Some other loggers worth mentioning:

from jongo.

bguerout avatar bguerout commented on June 28, 2024

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.

ihr avatar ihr commented on June 28, 2024

Out of interested why not use slf4j-api and then have the actual loggin implementation provided ?

from jongo.

bguerout avatar bguerout commented on June 28, 2024

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.

bguerout avatar bguerout commented on June 28, 2024

BTW, as JUL is the built-in JDK logging API, we could provide a JUL implementation of LogListener without any dependency

from jongo.

ihr avatar ihr commented on June 28, 2024

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.

codeallthethingz avatar codeallthethingz commented on June 28, 2024

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.

ihr avatar ihr commented on June 28, 2024

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.

geronimo-iia avatar geronimo-iia commented on June 28, 2024

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.

ihr avatar ihr commented on June 28, 2024

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.

geronimo-iia avatar geronimo-iia commented on June 28, 2024

@ihr Of course you could !!
Thanks for the joke

from jongo.

ihr avatar ihr commented on June 28, 2024

@geronimo-iia Glad to be of help!

from jongo.

SanderDN avatar SanderDN commented on June 28, 2024

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.

candidtim avatar candidtim commented on June 28, 2024

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.

SanderDN avatar SanderDN commented on June 28, 2024

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.

peter-moore-surverysampling avatar peter-moore-surverysampling commented on June 28, 2024

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.

stale avatar stale commented on June 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.