Created
September 24, 2011 16:42
-
-
Save sachin-handiekar/1239532 to your computer and use it in GitHub Desktop.
log4j Basic Configurator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.foo.Bar; | |
// Import log4j classes. | |
import org.apache.log4j.Logger; | |
import org.apache.log4j.BasicConfigurator; | |
public class MyApp { | |
// Define a static logger variable so that it references the | |
// Logger instance named "MyApp". | |
static Logger logger = Logger.getLogger(MyApp.class); | |
public static void main(String[] args) { | |
// Set up a simple configuration that logs on the console. | |
BasicConfigurator.configure(); | |
logger.info("Entering application."); | |
Bar bar = new Bar(); | |
bar.doIt(); | |
logger.info("Exiting application."); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment