|
The only pure Java Subversion library in the world!
|
|
Setting a custom logger (for debug logging)
When you're using JavaSVN in your application it is not always an option to let
JavaSVN use JDK logging API. Instead you may like to have a fine-grained control over
the way JavaSVN logs its operations. The solution is to provide JavaSVN with a custom logger
class that should extend the SVNDebugLoggerAdapter class. The code below demonstrates
how it could be done.
...
import org.tmatesoft.svn.util.SVNDebugLog ;
import org.tmatesoft.svn.util.SVNDebugLoggerAdapter ;
...
public static void initJavaSVNLogger() {
SVNDebugLog.setLogger(new CustomJavaSVNLogger());
}
private static class CustomJavaSVNLogger
extends SVNDebugLoggerAdapter {
public void log(String message, byte[] data) {
...
}
public void logInfo(String message) {
...
}
public void logError(String message) {
...
}
public void logInfo(Throwable th) {
...
}
public void logError(Throwable th) {
...
}
}
...
initJavaSVNLogger();
...
Note: One have to set up a custom logger before any other calls are made to
JavaSVN, otherwise default logging will be used - i.e. DefaultSVNDebugLogger (org.tmatesoft.svn.core.internal.util).
How to obtain its log files read this article.
If you have any questions regarding JavaSVN, would like to report a bug or contribute a patch, please write to
support@tmatesoft.com
|