Logging
Encog provides logging to allow you to see what is going on inside of the Encog framework. Logging is provided as a plugin. This allows you to define the level of logging that you want to make use of. It also eliminates the need of potentially unnecessary third party JAR/DLL files. This also allows platforms that do not support logging, such as Silverlight to not be impacted by logging. By default, all logging is disabled. If you want to use logging with Encog, you must enable it.
Contents |
Built in Logging Plugin
By default Encog makes use of a very simple built-in logging handler. The built-in logging handler only provides two logging options.
- Log to disk file
- Log to console
Enabling Console Logging
The following code will enable console logging in Java. The C# code is very similar. This will only work if you are using the system logging plugin. If you are using a different plugin, you will get a cast exception. In this case refer to the documentation for logging plugin you are using.
SystemLoggingPlugin logging = (SystemLoggingPlugin)Encog.getInstance().getLoggingPlugin(); logging.setLogLevel(EncogLogging.LEVEL_INFO); logging.startConsoleLogging();
Enabling File Logging
The following code will enable file logging in Java. The C# code is very similar. This will only work if you are using the system logging plugin. If you are using a different plugin, you will get a cast exception. In this case refer to the documentation for logging plugin you are using.
Coming soon
Logging Levels
Encog provides several log levels.
- LEVEL_DEBUG(0) - The lowest level log type. Debug logging provides low-level Encog diagnostics that may slow performance, but allow you to peer into the inner workings.
- LEVEL_INFO(1) - Info logging tells you when major processes start and stop.
- LEVEL_ERROR(2) - Error level tells you about errors, less important to critical.
- LEVEL_CRITICAL(3) - Critical logging logs errors that cannot be recovered from.
- LEVEL_DISABLE(4) - Logging is disabled at this level.
Optional Logging Plugins
Eventually other logging plugins will be made available. Optionally, you can write your own. When additional logging plugins are created I will expand this section. Soon plugins will be provided for log4j, log4net and JDK logging.