Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-1970: fix logger name in SPARQLProtocolSession #1971

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public class SPARQLProtocolSession implements HttpClientDependent, AutoCloseable
*/
private final int maximumUrlLength;

final Logger logger = LoggerFactory.getLogger(this.getClass());
final Logger logger = LoggerFactory.getLogger(SPARQLProtocolSession.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw. I prefer final static and possibly private for loggers.

Copy link
Contributor

@abrokenjester abrokenjester Mar 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with preferring private: as this example shows, inheriting loggers is just a recipe for confusion. Unfortunately, this was designed for this purpose in the past, so we're stuck with it at least until the next major release.

I'm not sure why you prefer static though. We use a LoggerFactory so there is very little overhead. And there may be issues caused by static logger references in some applications (see https://cwiki.apache.org/confluence/display/COMMONS/Logging+StaticLog ).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware of that issue. I mostly like static loggers because you can reference them from static context too.


/*-----------*
* Variables *
Expand Down