crwdns141861:0crwdne141861:0

crwdns141863:0crwdne141863:0

  • crwdns141865:0crwdne141865:0

  • crwdns141867:0crwdne141867:0

  • crwdns141869:0crwdne141869:0

crwdns141871:0crwdne141871:0

crwdns141873:0crwdne141873:0

crwdns141875:0crwdne141875:0

Note

crwdns141877:0:doc:crwdne141877:0

crwdns141879:0crwdne141879:0

import com.google.inject.Inject;
import org.apache.logging.log4j.Logger;

@Inject
private Logger logger;

crwdns141881:0crwdne141881:0

private Logger logger;

@Inject
private void setLogger(Logger logger) {
    this.logger = logger;
}

crwdns141883:0crwdne141883:0

// For the purpose of this example, "Banana" is the class name

private final Logger logger;

@Inject
public Banana(Logger logger) {
    this.logger = logger;
}

crwdns141885:0crwdne141885:0

crwdns141887:0crwdne141887:0

public Logger getLogger() {
    return logger;
}

crwdns141889:0crwdne141889:0

crwdns141891:0crwdne141891:0

Note

crwdns141893:0crwdne141893:0

getLogger().info("String");
getLogger().debug("String");
getLogger().warn("String");
getLogger().error("String");

crwdns141895:0crwdne141895:0

getLogger().warn("This is a warning!");