How to Log with log4j

1) Create the file:

import org.apache.log4j.Logger;

public final class Log4jSample {

  public static void main(final String[] args) {
    final Logger logger = Logger.getLogger(Log4jSample.class);"Hello World!");


2) Create the file:


log4j.logger.Log4jSample=INFO, A1

3) Compile the file.

4) Launch the Log4jSample class.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.