Our Sites | Alchemy NetCOBOL

NeoData Log/Trace File creation

Wednesday, March 02, 2011

Did you know that you can debug the NeoData events that occur while your program is running, by updating your App.Config file that is associated with the Executable/solution or project you are running? This information is valuable in tracing the events that are happening in your COBOL program interacting with NeoData.

There are two different types of logging you can do, but the first one, going to a file is strongly recommended, especially if you wish to send the information off to Support. The second one is writing to your Event Log, and will only be touched upon briefly.

The NeoData Help does a very nice job of covering the set-up of the trace logging and should be read in conjunction to this blog article.

This blog contains the following items:

* Set-up example of your NeoData Config File for writing to a trace log
* Sample output of the different levels of tracing you can turn on
* Sample full App.config file.

Set-up Example/Instructions for setting up a trace/log of your NEOData Events using your Config File

* Open up your App.Config file which is part of your solution that contains your COBOL programs.

* Go to the System Diagnostics section and you can copy/paste into the App.Config file the following:
Optionally change the Tracing level, path/file name to log to, listener name/type of listener, but, it should work just as is. You will need to change where you want the log stored(Look for “C:\MyData” as the folder, and change to your location. Be careful not to overlay existing code you may need:

<system.diagnostics>

<!-- The following section assigns determines the verbosity of tracing in NeoData. 1= errors only, 2=warnings also, 3=info also, 4=verbose. -->
<!-- Tracing beyond warning level should typically be disabled in production systems-->
<switches>
<add name="NeoDataTraceSwitch" value="4" /> <!— **Optionally Change **-->
</switches>

<!-- The following section assigns NeoData trace results to an external file. This is expensive in verbose mode(4), but useful in some debugging cases -->
<trace autoflush="true">
<listeners>
<add name="TestTracer" <!— **Optionally Change **-->
type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
initializeData="C:\MyData\NeoDataTrace.log" /> <!— **Change Folder Location **-->
</listeners>
</trace>

</system.diagnostics>

* Optionally set the NeoData Trace Switching (1-4) described below as you need them.

* Optionally change the listener name.

* Specify the type of “Systems.Diagnostics” Event logging you wish to do, being either TextWriterTraceListener (recommended strongly), or EventLogTraceListener (which goes to your Event Log).

You can point to a file location that you wish to write to, by using the “initializeData” field, and either giving a relative path, with just a file name, or specifying a full path as in the example contained in this blog(Shows C:\MyData\NeoDataTrace.log").

You have four levels of output that you can do based on the NeoDataTraceSwitch.

They are 1= Errors Only, 2=warnings also, 3=info also, 4=verbose.

(1) only gives you errors that have happened,

(2) thru (4) successively give you more information.

The higher the level you set the more data is generated, so the larger the file, the greater the impact to the application. If you run with a high level in a long application, your file will be very large, and it may noticeably impact performance. For this reason, only use the setting you need for the time you want to trace what is happening in your application in conjunction with NEOData. The sample output file shows the output that is generated depending on the NeoDataTraceSwitch level set (1,4)

Sample NEOData Log File Output

** With a 1 on.. errors only, (note – no errors, so nothing shown)

** With a 2 On...warnings also (note – simple message showing DataMapper startup)

NdInfo: 2011-02-11T15:36:59: DataMapper static startup beginning

** with a 3 on... warnings and info.

NDFullCycleReadOnlyTest.exe Information: 0 : NdInfo: NeoData Runtime Version: 2.0.10.0

NdInfo: 2011-02-11T15:38:17: Attempting to open Data Map C:\Alchemy\DocumentationAndSamplesWIP\NEODataFullCycle\NDFCYCLE.ndp

NdInfo: 2011-02-11T15:38:17: DataMapper static startup beginning

NdInfo: 2011-02-11T15:38:17: Successfully opened and deserialized Data Map C:\Alchemy\DocumentationAndSamplesWIP\NEODataFullCycle\NDFCYCLE.ndp

NDFullCycleReadOnlyTest.exe Information: 0 : NdInfo: Map Version: 2.0.6.0

NdInfo: 2011-02-11T15:38:17: WindowedTableMgr instantiating, with local AllowsBulkCopy=True

NdInfo: 2011-02-11T15:38:17: Successfully restored dependencies for Data Map

NdInfo: 2011-02-11T15:38:17: Successfully opened file

** With a 4 on ... verbose (the most information).

NDFullCycleReadOnlyTest.exe Information: 0 : NdInfo: NeoData Runtime Version: 2.0.10.0

NdInfo: 2011-02-11T15:41:15: Attempting to open Data Map C:\Alchemy\DocumentationAndSamplesWIP\NEODataFullCycle\NDFCYCLE.ndp

NdInfo: 2011-02-11T15:41:15: DataMapper static startup beginning

NdInfo: 2011-02-11T15:41:15: DataMapper instantiating, with Global AllowsBulkCopy=True

NdInfo: 2011-02-11T15:41:15: DataMapper static startup ending

NdInfo: 2011-02-11T15:41:16: Successfully opened and deserialized Data Map C:\Alchemy\DocumentationAndSamplesWIP\NEODataFullCycle\NDFCYCLE.ndp

NDFullCycleReadOnlyTest.exe Information: 0 : NdInfo: Map Version: 2.0.6.0

NdInfo: 2011-02-11T15:41:16: WindowedTableMgr instantiating, with local AllowsBulkCopy=True

NdInfo: 2011-02-11T15:41:16: Successfully restored dependencies for Data Map

NdInfo: 2011-02-11T15:41:16: Successfully opened file

NdInfo: 2011-02-11T15:41:18: Comparing the next two lines for equality: result True

Src: 30303332

Dst: 30303332

Sample: App.Config

Please note, if you use code from this App.config file, you will need to change at a minimum, the “C:\MyData”, to a folder location on your system, or create a folder called “C:\MyData”.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<system.diagnostics>

<!-- The following section assigns determines the verbosity of tracing in NeoData. 1= errors only, 2=warnings also, 3=info also, 4=verbose. -->
<!-- Tracing beyond warning level should typically be disabled in production systems-->
<switches>
<add name="NeoDataTraceSwitch" value="4" />
</switches>

<!-- The following section assigns NeoData trace results to an external file. This is expensive in verbose mode(4), but useful in some debugging cases -->
<trace autoflush="true">
<listeners>
<add name="TestTracer"
type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
initializeData="C:\MyData\NeoDataTrace.log" />
</listeners>
</trace>

</system.diagnostics>

<fujitsu.cobol>
<runtime>
<environmentSettings>
<add key="@CBR_EXFH_API" value="VDBFileHandler" />
<add key="@CBR_EXFH_LOAD" value="C:\Program Files\Alchemy Solutions\NeoData V2\V2\VDBFH.dll " />
<add key="GOODFILE" value="C:\MyData\NDFCYCLE.ndp,EXFH" />
<add key="GOODFILE_IDX" value="C:\MyData\GOODFILE" />

</environmentSettings>
</runtime>
</fujitsu.cobol>
</configuration>
Comments
Post has no comments.
Post a Comment




Captcha Image

Trackback Link
http://www.alchemysolutions.com/BlogRetrieve.aspx?BlogID=11346&PostID=316425&A=Trackback
Trackbacks
Post has no trackbacks.

Recent Posts


Tags


Archive

Contact Us | Privacy Policy | Terms of Use | Mainframe Migration | Cloud Solutions | NeoKicks | NeoData | NeoBatch
©2011 Alchemy Solutions. All rights reserved.