[slf4j-dev] [JIRA] Updates for SLF4J-507: Logger.getLogger (compact initialization)

QOS.CH (JIRA) noreply-jira at qos.ch
Mon Feb 8 08:13:00 CET 2021


SLF4J / SLF4J-507 [Open]
Logger.getLogger (compact initialization)

==============================

Here's what changed in this issue in the last few minutes.
This issue has been created
This issue is now assigned to you.

View or comment on issue using this link
https://jira.qos.ch/browse/SLF4J-507

==============================
 Issue created
------------------------------

Sergey Chernov created this issue on 08/Feb/21 8:02 AM
Summary:              Logger.getLogger (compact initialization)
Issue Type:           Improvement
Affects Versions:     2.0.0-alpha1
Assignee:             SLF4J developers list
Components:           Core API
Created:              08/Feb/21 8:02 AM
Environment:
  Manual definition of {{Logger}} field in class.
  
   
Priority:             Minor
Reporter:             Sergey Chernov
Description:
  Most common use case of logger declaration looks like
  
  {code}
  
  import org.slf4j.Logger;
  
  import org.slf4j.LoggerFactory;
  
  ...
  
  private static final Logger logger = LoggerFactory.getLogger(CurrentType.class);
  
  {code}
  
   
  
  It's almost fine, but it could be more compact:
  
  {code}
  
  import org.slf4j.Logger;
  
   ...
  
  private static final Logger logger = Logger.getLogger(CurrentType.class);
  
  {code}
  
   
  
  Before java 8 it was not possible ({{Logger}} is an interface, not abstract class), now since the minimum required version is 9, the static initialization method can be introduced in the interface.


==============================
 This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59)



More information about the slf4j-dev mailing list