Logging SVNKit operations

If you experience problems that you think are related to SVNKit, it is always a good idea to post a bug report into SVNKit Issue Tracker. To provide more information with the bug report, please consider attaching SVNKit log file to it. Below you will find detailed instructions on how to get SVNKit log files.

SVNKit is used as a library in a standalone application

By default SVNKit operations logging is switched off. To enable it, you should replace the contents of the JAVA_HOME/jre/lib/logging.properties file with the contents of the logging.properties.disabled file that you can find in your "standalone" archive or in the svnkit-cli/scripts directory in case you've checked out the SVNKit sources. Or when launching the Java VM you can use the following system property:

$java -Djava.util.logging.config.file=path/to/logging.properties.disabled

The logging.properties.disabled file contains several system properties which is used to control the log level. Every property corresponds to different area of SVNKit operations:

Up to your needs you can specify the following values for every property above:

You may find an SVNKit log file at USER_HOME/svnkit.0.log.

SVNKit is used as Eclipse plugin (works for Subclipse extension as well)

When used within Eclipse SVNKit logs its operation using Eclipse built-in logging facilities. Logging is turned off by default. To enable SVNKit logging please do the following:

  1. Copy ECLIPSE_HOME/plugins/org.tmatesoft.svnkit_version/.options file to ECLIPSE_HOME directory

  2. Start Eclipse with -debug command line argument:

$eclipse -debug
  1. In Eclipse, open standard 'Error Log' view - it will contain detailed log of SVNKit operations that you may export to a file.

ECLIPSE_HOME/plugins/org.tmatesoft.svnkit_version/.options is a file in Java properties file format, with key=true or key=false pair per line. It contains following options with boolean values you can specify:

Note: if this option is turned on error messages will be shown in the 'Error Log' output independently of whether org.tmatesoft.svnkit/debug is turned on or not

Note: if this option is turned on network traffic will be shown in the 'Error Log' output independently of whether org.tmatesoft.svnkit/debug is turned on or not

Setting a custom logger (for debug logging)

When you're using SVNKit in your application it is not always an option to let SVNKit use JDK logging API. Instead you may like to have a fine-grained control over the way SVNKit logs its operations. The solution is to provide SVNKit with a custom logger class that should extend the SVNDebugLogAdapter class. The code below demonstrates how it could be done.

   1 ...
   2 import org.tmatesoft.svn.util.ISVNDebugLog;
   3 import org.tmatesoft.svn.util.SVNDebugLog;
   4 import org.tmatesoft.svn.util.SVNDebugLogAdapter;
   5 import org.tmatesoft.svn.util.SVNLogType;
   6 ...
   7     
   8     /*
   9      * Register your logger for different kinds of operations (operations with working copy, network operations). 
  10      */
  11     public static void initSVNKitLogger() {
  12         ISVNDebugLog customLogger = new CustomSVNKitLogger();
  13         SVNDebugLog.setDefaultLog(customLogger);
  14     }
  15 
  16     private static class CustomSVNKitLogger 
  17                                    extends SVNDebugLoggerAdapter {
  18         /* Define methods to handle log messages
  19          * as you wish.
  20          */
  21 
  22         public void log(SVNLogType logType, byte[] data, Level logLevel) {
  23             /*
  24              * Used to log all data received or transmitted 
  25              * over network
  26              */
  27             ...
  28         }
  29 
  30         public void log(SVNLogType logType, String message, Level logLevel) {
  31             /*
  32              * Used to log messages with different log levels
  33              */
  34             ...
  35         }
  36 
  37         public void log(SVNLogType logType, Throwable th, Level logLevel) {
  38             /*
  39              * Used to log exceptions with different log levels
  40              */
  41             ...
  42         }
  43     }
  44 ...
  45     initSVNKitLogger();
  46 ...    

Note: One have to set up a custom logger before any other calls are made to SVNKit, otherwise default logging will be used - i.e. DefaultSVNDebugLogger. The first section gives information how to obtain its log files.

Troubleshooting (last edited 2012-01-03 18:07:26 by ip-109-80-120-205)