Configuring Cyc API Logging

All Cyc APIs use the SLF4J logging API. This makes it much easier to integrate them with your preferred logging framework, but it also means that some configuration is necessary for the API to produce log output.

In particular, a logging framework must be added to your application’s classpath, along with the SLF4J binding jar for that logging framework. Without those components (and the SLF4J API jar) on your application’s classpath, the Cyc APIs will not log anything.

Note that, although the SLF4J API jar must always be available (as the Cyc APIs have direct dependencies upon them) the actual logging framework implementation need only be present at run time.

Downloads

All SLF4J downloads mentioned below can be found at SLF4J download page. Alternately, you can find their maven download coordinates at either of these links:

If you DO already have a logging framework…

  1. Make sure that slf4j-api jar, version 1.7.12 or higher (e.g., slf4j-api-1.7.12.jar), is on your classpath.

  2. Find the appropriate SLF4J binding jar for your logging framework, and include it on your classpath. You can find a list of SLF4J bindings (for log4j, java.util.logging, Jakarta Commons Logging, etc.) in the “Binding with a logging framework at deployment time” section in the SLF4J manual.

For example, if you were using Jakarta Commons Logging v1.2, you’d need the following on your classpath:

  • slf4j-api-1.7.12.jar
  • slf4j-jcl-1.7.12.jar
  • commons-logging-1.2.jar

Lastly, you’ll need to configure the logging framework to your preferred logging levels. See your logging framework documentation for details.

If you DO NOT already have a logging framework…

There are a lot of great logging frameworks out there; we tend to use log4j. To set up log4j 1.2:

  1. Make sure that slf4j-api-1.7.12.jar is on your classpath.

  2. Make sure that slf4j-log4j12-1.7.12.jar is on your classpath.

  3. Download log4j 1.2.17 (or higher) and place it on your classpath.

  4. Plage a log4j.properties file into the root of your classpath. You can download an example here.

That should be all that’s necessary. You may need to restart your application’s JVM).

The example log4j file provided should be sufficient to get you started, but for more details on configuring log4j, see: