Search code examples
kofax

custom module write messages to Kofax log files


When creating export scripts it is possible to log information to the Kofax log files. An example would be

documentData.LogError(0, 0, 0, "error log", "Export Script", 0);

When creating custom modules, is there an equivalent method? Due to the fact the application is an external program I am not sure if it's possible to write to the Kofax log files.

But maybe some objects during setup and runtime have some log methods.

The interfaces IBatchClass (setup), IBatch (runtime) and IACDataElement (runtime) don't have any of these methods.


Solution

  • Setup

    Use the LogError method on the AdminApplication class that is exposed by Kofax when the setup OCX loads.

    Runtime

    Custom modules rely on the Kofax.Capture.SDK.CustomModule assembly. You can either log errors with the ILogin or Login2 object using the LogError method - this one has the same signature as for the export connectors, or you could go the extra mile and implement some real logging using Log4Net.

    Here's an example how to use the login object during runtime:

    static void Run(string[] args)
    {
        // start processing here
        // todo encapsulate this to a separate class!
    
        // login to KC
        var login = new Login();
        login.EnableSecurityBoost = true;
        login.Login();
        login.ApplicationName = "Quipu.KC.CM";
        login.Version = "1.0";
        login.ValidateUser("Quipu.KC.CM.exe", false, "", "");
        // more code comes here