Tracing in Code Modules

  • 16 November 2005
  • 6 replies
  • 1 view

Badge
Hello, is it possible to output to the K2 tracing log using system.diagnotics.trace inside of a code module? This would be helpful in our development environment. Thanks! 8)

6 replies

Badge +11
Hi,

As far as I know, it is not possible to append custom messages to the K2 trace file. You'll have to write your own tracing functionality to a separate file.

Regards,
Ockert
Badge +13
I enabled tracing on K2 server, but all the log has is this:
How do I see more information?

02-11-06 09:02:46 K2.net Server Version 3.6262.1.0 SP4
02-11-06 09:02:46 ------------------------------------
02-11-06 09:02:46 Server starting
02-11-06 09:02:46 Loading .NET Framework v1.1.4322
02-11-06 09:02:46 Framework loaded successfully
Badge
Hi

If you enabled Performance Monitoring in the K2Server.config file you'll need to give the K2.net service account Admin rights to create performance counters categories.
<PerfMonCounters Enable="True" Interval="300" />

If you enabled logging everything should be fine except if you use the Preserve sequence number logging option, then
you'll will need to give the K2.net server account read and write access to the following registry key HKEY_LOCAL_MACHINESOFTWARESourceCode

The service account also requires full control on the Bin folder (usually C:Program FilesK2.net 2003Bin)

Please review section 2.1.1 of the installation documentation.

Hope this helps.

Bernard
Badge +13
Is Tracing related to Performance Counter or K2 activities?

I still don't see anything in the log.
Also I never see k2error.log created in the in directory. Does that file reside somewhere else?

Is there a K2 object in Studio that I can use to log text to either console (when server running in console mode), or k2error.log?
Badge +8
Is there a K2 object in Studio that I can use to log text to either console (when server running in console mode), or k2error.log?

If K2 server is running in console mode, you can simply add a statement like this to the event:


Console.WriteLine("something you want to output");


This statement will write output to the console window at runtime. (My suggestion: add some visual separators (eg. #### or ~~~) to the statement, so that you can easily identify the output in the console window.)

But wait, there's more!
SP4 of K2.net 2003 features the ultra-cool logging framework. You can output custom tracing/logging information to the same logfiles as K2.net uses. Have a look at the K2.net 2003 Logging and Monitoring file that will be installed along with K2.net 2003 SP4's help files.

As an example, you can output to the console/logfiles using the logging framework like so:

K2.ProcessInstance.Logger.LogDebugMessage(messageSOurce,messageString);

or

K2.ProcessInstance.Logger.LogInfoMessage(messageSOurce,messageString);


There's a whole lot of options when it comes to the logging framework - have a look at the helpfile mentioned earlier.
Badge +13
Thanks, somehow I missed that. I was searching inside K2Studio and K2ROM help files for logging.

The ProcessInstance Help in K2 Studio dosen't mention about the Logger method.

Is Tracing file redundant (obsolete) now? It still doesn't have anything in there.

Reply