A small survey about logging in Java

Help me conduct a small survey about logging in the Java Eco System!

Fill in the survey! Results will be published in the next month.

5 Replies to “A small survey about logging in Java”

  1. Hi Pol

    About static loggers or not?
    Why wouldn’t you use static when defining a logger in a class? In most logging frameworks the logger you retrieve with a specific name will be the same one over and over. When you have multiple instances of that class it will always be that same logging object. There probably are cases where you wouldn’t want that and want to avoid the usage of static but I can’t directly think of one.

    multiple loggers per object? is it useful?
    That would depend on your use cases. Perhaps you want security related info in another log file then general application info or errors. Then definitely, multiple loggers.

    Pass logging to another object or use AOP for logging?
    IMO these are both different things and 2 questions. Passing logging to another object on construction or with a method call is not a thing I would generally do. Cases where I would implement the logging as but then as listener/observer interface for a certain class that does a certain thing and where the consumer of that class can then decide to log or not to log (e.g. in excel parser class that provides logging feedback to a webapplicationuser in the browser).
    For AOP, we usually do not use AOP logging during the initial build of the application. But logging with AOP can come in very handy when an application is already live and you want to add logging to certain classes/methods/packages without changing to much of the source code.

    Just my 2cents

  2. I am also more interested in more basic logging questions:

    How to define the logger:
    static loggers or not? there are still heavy discussions.

    multiple loggers per object? is it useful?

    Pass logging to another object or use AOP for logging?

  3. Some feedback about the survey:

    “commons logging” is not a logging framework, it is abstraction (similar to SLF4J), so it should be under “Do you use an abstraction layer for easy switching?”

    “As less as possible, only to log errors” -> “As little as possible, only to log errors” (less vs little)

    “We write a lot of log statement, it’s good to see what’s happening” -> “We write a lot of log statements, it’s good to see what’s happening” (statement vs statements)

    About “Saas logging collector like Sumologic, Loggly, Boundary” – Boundary is not a logging collector, it is performance monitoring service (via agents).

    And, I’m not sure how much sense does it make to ask questions about “the most” and then giving the option to select more than one answer 😛

    Otherwise nice survey, I’m impatiently waiting for the results! 🙂


    1. Updated! Thanks for the spellings corrections.

      About commons logging, I’ve never used it, made the wrong assumption, didn’t google it. It’s kind of annoying to change that in the survey now, so added a note. Little vs Less, yes, English is not my mother tongue. And for the ‘most’ question. What if you use two levels equally as much? That’s the reason. But it’s true, it could give a false image, but I’ll work that into the survey write up. I’m waiting for more responses, a the moment I’m on 65 in my opinion that’s not enough. I’ll have to spam some twitter messages during DevoxxUK and DevoxxFR 😉

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.