How to log inside "Invoke code" activity?

activities

#1

Hi,

I’m wondering whether it is possible to log messages inside “Invoke code” activity in the same manner as the “Log message” activity does? Is there for example a particular namespace that contains the logging methods so that I could use them inside “Invoke code” activity? This would be useful so that I could get more fine-tuned information about what happens inside the “Invoke code” activity.


#2

You could try to use Console.WriteLine ?
It should basically log Trace level messages. This is by far the easiest way of doing it that I can think of.


#3

uipath.Core.Activities.LogMessage()


#4

Thank you for your reply. I have been using Console.WriteLine method so far but the problem with this is that log messages don’t appear in Orchestrator even though I specify the log level as Trace.


#5

Thank you! This seems to do the trick. Using this approach I managed to get the logging working with the following piece of code:

Dim logMessage As UiPath.Core.Activities.LogMessage = New UiPath.Core.Activities.LogMessage()
logMessage.Level = UiPath.Core.Activities.CurentLogLevel.Error
logMessage.Message = "Hello World!"
Dim logInvoker As WorkflowInvoker = New WorkflowInvoker(logMessage)
logInvoker.Invoke()

#6

Gr8! Yes we need to invoke the logmessage to get this class work in invoke code


#7

You started a Brilliant topic my friend. Hats off to you @Ledorin and @Atrimal for providing us all with this valuable piece of Info.


#8

How about in C# ?

I am creating a Custom Activity and use Console.writeline so far I watch the value from output panel in studio but I can not see in the Orchestrator log.

please some a good man suggest me how to do it.

thanks in advance.