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:
|Do not log anything
|Log any errors that are caught during the API operation
|Potential configuration problems or harmful situations
|Informational messages about API operation suitable for production use
|Fine-grained information for debugging and support purposes
|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.
|Enable logging to the console
|Set the level at which the console will log
|Enable logging to file
|Set the level for logging to file
|The path to the log file
|The maximum number of rolling log files
|The maximum size of each rolling log file
|Prevent the logging system from creating a watcher thread on logging.properties configuration file.