Tabnine Logo
Logger
Code IndexAdd Tabnine to your IDE (free)

How to use
Logger
in
org.slf4j

Best Java code snippets using org.slf4j.Logger (Showing top 20 results out of 216,783)

origin: iluwatar/java-design-patterns

 /**
  * Simulate the read operation
  * 
  */
 public void read() throws InterruptedException {
  LOGGER.info("{} begin", name);
  Thread.sleep(readingTime);
  LOGGER.info("{} finish after reading {}ms", name, readingTime);
 }
}
origin: iluwatar/java-design-patterns

/**
 * Starts the reactor event loop in a new thread.
 */
public void start() {
 reactorMain.execute(() -> {
  try {
   LOGGER.info("Reactor started, waiting for events...");
   eventLoop();
  } catch (IOException e) {
   LOGGER.error("exception in event loop", e);
  }
 });
}
origin: spring-projects/spring-framework

public void debug(Object message) {
  if (message instanceof String || this.logger.isDebugEnabled()) {
    this.logger.debug(String.valueOf(message));
  }
}
origin: spring-projects/spring-framework

public void warn(Object message) {
  if (message instanceof String || this.logger.isWarnEnabled()) {
    this.logger.warn(String.valueOf(message));
  }
}
origin: spring-projects/spring-framework

public void error(Object message, Throwable exception) {
  if (message instanceof String || this.logger.isErrorEnabled()) {
    this.logger.error(String.valueOf(message), exception);
  }
}
origin: netty/netty

@Override
public void warn(String msg) {
  logger.warn(msg);
}
origin: apache/incubator-dubbo

@Override
public void debug(Throwable e) {
  if (locationAwareLogger != null) {
    locationAwareLogger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, e.getMessage(), null, e);
    return;
  }
  logger.debug(e.getMessage(), e);
}
origin: apache/kafka

private boolean threadShouldExit(long now, long curHardShutdownTimeMs) {
  if (!hasActiveExternalCalls()) {
    log.trace("All work has been completed, and the I/O thread is now exiting.");
    return true;
  }
  if (now >= curHardShutdownTimeMs) {
    log.info("Forcing a hard I/O thread shutdown. Requests in progress will be aborted.");
    return true;
  }
  log.debug("Hard shutdown in {} ms.", curHardShutdownTimeMs - now);
  return false;
}
origin: iluwatar/java-design-patterns

private static void artificialDelayOf(long millis) {
 try {
  Thread.sleep(millis);
 } catch (InterruptedException e) {
  LOGGER.error("sleep interrupted", e);
 }
}
origin: skylot/jadx

  public static void setClipboardString(String text) {
    try {
      Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
      Transferable transferable = new StringSelection(text);
      clipboard.setContents(transferable, null);
      LOG.debug("String '{}' copied to clipboard", text);
    } catch (Exception e) {
      LOG.error("Failed copy string '{}' to clipboard", text, e);
    }
  }
}
origin: netty/netty

@Override
public void trace(String msg) {
  logger.trace(msg);
}
origin: apache/incubator-dubbo

@Override
public boolean isDebugEnabled() {
  return logger.isDebugEnabled();
}
origin: spring-projects/spring-framework

public void trace(Object message) {
  if (message instanceof String || this.logger.isTraceEnabled()) {
    this.logger.trace(String.valueOf(message));
  }
}
origin: netty/netty

@Override
public void warn(String format, Object arg) {
  logger.warn(format, arg);
}
origin: apache/incubator-dubbo

@Override
public void debug(String msg) {
  if (locationAwareLogger != null) {
    locationAwareLogger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, msg, null, null);
    return;
  }
  logger.debug(msg);
}
origin: iluwatar/java-design-patterns

 private static long ap(long i) {
  try {
   Thread.sleep(i);
  } catch (InterruptedException e) {
   LOGGER.error("Exception caught.", e);
  }
  return i * (i + 1) / 2;
 }
}
origin: skylot/jadx

public static void store(JadxSettings settings) {
  try {
    String jsonSettings = makeString(settings);
    LOG.debug("Saving settings: {}", jsonSettings);
    PREFS.put(JADX_GUI_KEY, jsonSettings);
    PREFS.sync();
  } catch (Exception e) {
    LOG.error("Error store settings", e);
  }
}
origin: spring-projects/spring-framework

public void error(Object message) {
  if (message instanceof String || this.logger.isErrorEnabled()) {
    this.logger.error(String.valueOf(message));
  }
}
origin: spring-projects/spring-framework

public void warn(Object message, Throwable exception) {
  if (message instanceof String || this.logger.isWarnEnabled()) {
    this.logger.warn(String.valueOf(message), exception);
  }
}
origin: netty/netty

@Override
public void trace(String format, Object... argArray) {
  logger.trace(format, argArray);
}
org.slf4jLogger

Javadoc

The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that logging takes place through concrete implementations of this interface.

Typical usage pattern:

 
import org.slf4j.Logger; 
import org.slf4j.LoggerFactory; 
public class Wombat { 
final static Logger logger = LoggerFactory.getLogger(Wombat.class); 
Integer t; 
Integer oldT; 
public void setTemperature(Integer temperature) { 
oldT = t;         
t = temperature; 
logger.debug("Temperature set to {}. Old temperature was {}.", t, oldT); 
if(temperature.intValue() > 50) { 
logger.info("Temperature has risen above 50 degrees."); 
} 
} 
} 

Most used methods

  • info
    This method is similar to #info(String,Object[])method except that the marker data is also taken int
  • error
    This method is similar to #error(String,Object[])method except that the marker data is also taken in
  • debug
    This method is similar to #debug(String,Object[])method except that the marker data is also taken in
  • warn
    This method is similar to #warn(String,Object[])method except that the marker data is also taken int
  • isDebugEnabled
    Similar to #isDebugEnabled() method except that the marker data is also taken into account.
  • trace
    This method is similar to #trace(String,Object...)method except that the marker data is also taken i
  • isTraceEnabled
    Similar to #isTraceEnabled() method except that the marker data is also taken into account.
  • isInfoEnabled
    Similar to #isInfoEnabled() method except that the marker data is also taken into consideration.
  • isWarnEnabled
    Similar to #isWarnEnabled() method except that the marker data is also taken into consideration.
  • isErrorEnabled
    Similar to #isErrorEnabled() method except that the marker data is also taken into consideration.
  • getName
    Return the name of this Logger instance.
  • getName

Popular in Java

  • Updating database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • getResourceAsStream (ClassLoader)
  • setContentView (Activity)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Menu (java.awt)
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now