Logging with K2[blackpearl]

What logging information is available with K2 and how can I get access to it?

On the K2 server install directory\hostserver\bin directory you will find an XML file named HostServerLogging.config

This file has all the configuration information for the logging performed by K2 server.


You can send log messages to a File, Event log, Server console and so on. The error levels and when exceptions are thrown whether you need stack trace to be logged as well are also configured here.


Since K2 is building on top of WF you can also access the .xoml files generated by K2 for destination rules, line rules and other events. In here you can use the WF fault handling mechanism provided to log and/or handle errors. The event context  object “K2” gives you access to a Logger object forthe process sintance, which you can use to log messages.

K2.ProcessInstance.Logger.LogInfoMessage(“msg”, “my message”);


K2.net 2003 had event activity and process level exception handling bocks which allowed you to write custom code to handle exceptional scenarios. This will be available in K2[blackpearl]

You can also update K2 default template .xoml files to include your fault handling as standard. This will insert any logging code you have in to the process as you model.

If you look at K2 blackmarket you will also find a custom logger posted there – http://k2underground.com/k2/ProjectHome.aspx?ProjectID=2

%d bloggers like this: