The Maverick Synergy Java SSH API uses an internal logging mechanism so that no logging framework is enforced upon developers using the API. This comes with the benefit that logging can easily be isolated for support purposes and then our logging does not complicate or infect your own logging output.
The following log levels are available to you:
|NONE||Do not log anything|
|ERROR||Log any errors that are caught during the API operation|
|WARN||Potential configuration problems or harmful situations|
|INFO||Informational messages about API operation suitable for production use|
|DEBUG||Fine-grained information for debugging and support purposes|
|TRACE||Even finer-grained information including binary data input/output designed for debugging and support purposes|
You can enable logging in a number of ways. The most simple way to enable logging is to programmatically enable it from your own code. For example, to enable logging to the console call:
If you would prefer to log to file, you can call:
You can control much more of the logging options by creating a logging configuration file. By default, this should be in a file called logging.properties in the current working directory of the process.
You can override the default location and file name by setting the system property:
This logging configuration file is watched by the API so any changes you make to the file during runtime will cause the logging configuration to be reloaded. For example, if you experiencing problems during a running application you can enable DEBUG logs simply by editing the logging.properties file.
Watching the configuration file involves a thread. If you do not want this behavior you can disable it using the
maverick.log.nothread property setting it to a value of
true. The API installs a shutdown hook to tear this thread down, however, there are circumstances where this is too late and applications like Tomcat Servlet Container can complain about memory leaks. You can alternatively force the shutdown of this thread from your own application using:
If you do not include or set up logging.properties, you can set any of the following properties as System properties on your Java command line.
|maverick.log.console||false||Enable logging to the console|
|maverick.log.console.level||INFO||Set the level at which the console will log|
|maverick.log.file||false||Enable logging to file|
|maverick.log.file.level||INFO||Set the level for logging to file|
|maverick.log.file.path||synergy.log||The path to the log file|
|maverick.log.file.maxFiles||10||The maximum number of rolling log files|
|maverick.log.file.maxSize||20MB||The maximum size of each rolling log file|
|maverick.log.nothread||false||Prevent the logging system from creating a watcher thread on logging.properties configuration file.|