Solved

Logging in Custom Service Broker or Assemblies

  • 11 September 2017
  • 3 replies
  • 29 views

Badge +1

Hi,

 

is it possible wo write in the K2 Logs from custom code like a custom service broker or a assembly used in custom code event?

Does anyone know best practices or any tips for logging in such custom K2 solutions?

 

 

Thanks in advance,

 

Andreas

icon

Best answer by Perc 23 October 2017, 12:24

View original

3 replies

Badge +12

Hi Andreas,


 


I hope all is well, thank you for logging this community post. In regards to your query it may be a good idea to have a look at the following document from our developers reference on how this can be implemented.


 


https://help.k2.com/onlinehelp/k2blackpearl/devref/4.7/default.htm#Custom_Logging_Extension.htm


 


Kind regards, 


 


Perc

Badge +1

Hi Perc,

 

thank you for your answer. As I understand the article described in the link it shows how to create a custom logger for K2 events, that normally would be logged in the K2 Log. What I would need is a to log custom events from my Service Broker into the K2 Logs.

 

Best regards,

Andreas 

Badge +12

Hi Andreas, 


 


Did you have a look at the section under deployment and registration?.  Did you go through the following instructions within the document. 


 



  1. Stop the K2 service

  2. Copy the output assembly to the following folder on all K2 Servers: [Program Files (x86)]K2 blackpearlHost ServerBIN

  3. Edit the file [Program Files]Host ServerBinHostServerLogging.config and register the custom logging extension by adding an entry to the <Extensions>node. See a sample below; replace the values in square brackets with the appropriate values for your logging extension.

  4. Enable the logging extension by adding an entry to the <LogLocationSettings> node. See a sample below, and replace the values in square brackets with the appropriate values for your logging extension. Also configure the LogLevel setting to whatever level of Logging messages you wish to output to your logging extension. 


    1. "Name" must match the <Extension Name> value you used in step 3 above.




"Active" enables or disables the logger"LogLevel" determines the severity of the messages that will be forwarded to the logger. Available LogLevels are "All", "Debug", "Info", "Warning" and "Error"


 


This should then log the output from the custom service broker here.


 


Kind regards, 


 


Percy

Reply