Home : DotImage : Enable Trace Logging in DotTwain
Q10027 - HOWTO: Enable Trace Logging in DotTwain

DotTwain has tracing code added to it in order to help us debug a problem.  You can enable tracing by adding an Application Configuration File (app.config) to your project.  Then add the following code to create a TraceSwitch named "Atalasoft.Twain".

<add name="Atalasoft.Twain" value="4" />
<trace autoflush="true" indentsize="4">
<add name="DotTwainListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\users\YOUR_USERNAME\Documents\DotTwain.log" />

When you run your project, the DotTwain trace information will be listed in the Output - Debug window within Visual Studio.  The above code also creates a listener that will output the trace information to a log file (c:\users\YOUR_USERNAME\Documents\DotTwain.log).

IMPORTANT: set the InitializeData path to a location that the user running the app has full write access to and make sure the folder exists. This article used to say c:\DotTwain.log but we found that direct writing to the root of the C drive failed for non administrative users.

Please consider creating a directory under your profile then providing the full path to that such as


If no log is written, try running the application as administrator... and make sure the path defined exists and is writable

You can learn more about tracing from MSDN:  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconconfigurationoftraceswitches.asp

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?


Tell us why you rated the content this way. (optional)
Approved Comments...
No user comments available for this article.

Powered By InstantKB.NET v1.3
Copyright © 2002, 2020. InstantASP Ltd. All Rights Reserved