Skip to content
Snippets Groups Projects
Commit 177b9d86 authored by Brian Carrier's avatar Brian Carrier
Browse files

Merge pull request #2 from pidge/jni-verbose-logging

JNI support for enabling verbose logging
parents 2bbda9df bdf8ff64
No related branches found
No related tags found
No related merge requests found
......@@ -21,9 +21,10 @@
# Visual Studio user options
/win32/tsk-win.suo
# Make crud
*.o
*.lo
*.la
Makefile
.deps
.libs
.libs
\ No newline at end of file
......@@ -808,6 +808,24 @@ Java_org_sleuthkit_datamodel_SleuthkitJNI_getVersionNat(JNIEnv * env,
return jversion;
}
/*
* Enable verbose logging and redirect stderr to the given log file.
* @param env pointer to java environment this was called from
* @param obj the java object this was called from
* @param logPath The log file to append to.
*/
JNIEXPORT void JNICALL
Java_org_sleuthkit_datamodel_SleuthkitJNI_startVerboseLoggingNat
(JNIEnv * env, jclass obj, jstring logPath)
{
jboolean isCopy;
char *str8 = (char *) env->GetStringUTFChars(logPath, &isCopy);
if (freopen(str8, "a", stderr) == NULL) {
throwTskError(env, "Couldn't open verbose log file for appending.");
return;
}
tsk_verbose++;
}
/*
* Create an index for the given database path
......@@ -825,6 +843,7 @@ Java_org_sleuthkit_datamodel_SleuthkitJNI_createLookupIndexNat (JNIEnv * env,
TSK_HDB_OPEN_ENUM flags = TSK_HDB_OPEN_NONE;
TSK_HDB_INFO * temp = tsk_hdb_open(dbPathT, flags);
if (temp == NULL) {
throwTskError(env);
return;
}
......
......@@ -15,6 +15,14 @@ extern "C" {
JNIEXPORT jstring JNICALL Java_org_sleuthkit_datamodel_SleuthkitJNI_getVersionNat
(JNIEnv *, jclass);
/*
* Class: org_sleuthkit_datamodel_SleuthkitJNI
* Method: startVerboseLoggingNat
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_sleuthkit_datamodel_SleuthkitJNI_startVerboseLoggingNat
(JNIEnv *, jclass, jstring);
/*
* Class: org_sleuthkit_datamodel_SleuthkitJNI
* Method: newCaseDbNat
......
......@@ -25,6 +25,7 @@
public class SleuthkitJNI {
//Native methods
private static native String getVersionNat();
private static native void startVerboseLoggingNat(String logPath);
//database
private static native long newCaseDbNat(String dbPath) throws TskException;
......@@ -224,6 +225,15 @@ static CaseDbHandle openCaseDb(String path) throws TskException {
public static String getVersion(){
return getVersionNat();
}
/**
* Enable verbose logging and redirect stderr to the given log file.
* @return the version string
*/
public static void startVerboseLogging(String logPath) {
startVerboseLoggingNat(logPath);
}
/**
* open the image and return the image info pointer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment