Skip to content

Instantly share code, notes, and snippets.

@OpenGamma-Blog
Created September 28, 2012 11:13
Show Gist options
  • Save OpenGamma-Blog/3799233 to your computer and use it in GitHub Desktop.
Save OpenGamma-Blog/3799233 to your computer and use it in GitHub Desktop.
slf4j example 2
public class OGNativeCodeWrapper {
// initialises the logger by caching the static references to the method IDs etc
private static native void initialiseLogger();
private static Logger log;
static
{
try
{
System.loadLibrary("NativeLibraryWrapper"); // Load the native library wrapper with symbols to logging routines overridden
}
catch (UnsatisfiedLinkError e)
{
System.err.println("Cannot find system library.\n" + e);
// handle error
}
initialiseLogger();
log = LoggerFactory.getLogger(OGNativeCodeWrapper.class);
log.info("Logging started for native OGNativeCodeWrapper calls");
}
// native wrapper code goes below
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment