SVNKit The only pure Java Subversion client library in the world!

Home Get Library Knowledge Base Licensing

Logging SVNKit operations

If you experience problems that you think are SVNKit related, 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 file.

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:

  • Copy ECLIPSE_HOME/plugins/org.tmatesoft.svnkit_version/.options file to ECLIPSE_HOME directory
  • Start Eclipse with -debug command line argument:
    $eclipse -debug
  • In Eclipse, open standard 'Error Log' view - it will contain detailed log of SVNKit operations that you may export to a file.

Note: OS X users may find it useful to read this article. It describes how to start Eclipse in "-debug" mode.

SVNKit is used as library in 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/ 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 a system property svnkit.level used to control the log level. Up to your needs you can specify the following values for that property:

  • FINE(default) - the level for not detailed logging
  • FINER - the level for more detailed logging
  • FINEST - the level for full logging

You may find a SVNKit log file at USER_HOME/.svnkit/.svnkit.0.0.log.

Setting up your own logger

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 custom logger class that should extend SVNDebugLoggerAdapter class. The code below demonstrates how it could be done.

....
import org.tmatesoft.svn.util.DebugLog;
import org.tmatesoft.svn.util.SVNDebugLoggerAdapter;
....
    public static void initSVNKitLogger() {
        DebugLog.setLogger(new CustomSVNKitLogger());
    }

    private static class CustomSVNKitLogger 
                                   extends SVNDebugLoggerAdapter {
    	/* Override superclass methods to redirect logging
    	 * as you wish. Superclass implementaion is empty, i.e.
    	 * all log messages are swallowed.
    	 */
         
         
         public void log(String message, byte[] data) {
             /*
              * Used to log all data received or transmitted 
              * over network
              */
             ...
         }
         
         public void logInfo(String message) {
             /*
              * Used to log information messages
              */
             ...
         }

         public void logError(String message) {
             /*
              * Used to log error messages
              */
             ... 
         }

         public void logInfo(Throwable th) {
             /*
              * Used to log information on exceptions
              */
             ...
         }

         public void logError(Throwable th) {
             /*
              * Used to log exceptions
              */
             ...
         }
    }
....

Note: One have to set up the custom logger before any other calls are made to SVNKit, otherwise default logging will be used.



If you have any questions regarding SVNKit, would like to report a bug or contribute a patch, please write to support@svnkit.com


Java™ and all Java-based marks are a trademark or registered trademark of Sun Microsystems, Inc, in the United States and other countries. TMate Software and the website svnkit.com are independent of Sun Microsystems, Inc. and have no relationship, formal or informal.