How to Log with Log Bridge and log4j

1) Create the LogBridgeSample.java file:

import org.grlea.logBridge.LogBridge;
import org.grlea.logBridge.LogBridgeManager;

public final class LogBridgeSample {

  public static void main(final String[] args) {
    final LogBridge bridge = LogBridgeManager.createLogBridge(LogBridgeSample.class);

    bridge.info("Hello World");
  }

}

2) Create the logBridge.properties file:

org.grlea.logBridge.LogBridgeFactory=org.grlea.logBridge.impl.Log4JLogBridgeFactory # default is org.grlea.logBridge.impl.NullLogBridgeFactory

3) Create the log4j.properties file:

log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.logger.LogBridgeSample=INFO, A1

4) Compile the LogBridgeSample.java file.

5) Launch the LogBridgeSample class.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s