Write trace log from custom activity

I am creating a custom activity.
The activity is working fine.
But i need to have some logs generated when the activity is executing.
how do I achieve that?
I need some trace and some info logs to be written when the activity executes.

1 Like

You could use the Log message activity to write logs before or after the activity. Within the custom activity itself I dont think we have the ability to log the messages.

hey @akhi_s27

If you are not able to generate a log from Log activity with custom activities then you can also use writeline activity. it will be shown in the log as well.

May be to check that activity is executing or not add writeline before this activity i.e. something like this “activity started” and add one more after that custom activity. if your activity is working well then you will be able to see the last one log written in writeline and what others you can do is if your custom activity is generating any exception then use try-catch as well.

Let me know, if this helps or not?


(Below is a semi-speculation answer)

Since UiPath uses NLog, you might be able to reference it’s assembly dynamically and use GetLogger,
Use Console.Write/WriteLine - while not ideal, it should be intercepted I think (not tested),
Add NLog or equivalent to your assembly and create your logs from there (you could also try pointing it to UiPath’s NLog.config, not sure if it’ll work though).



thanks for directing me towards NLog.
i’ll try the Console.writeline.

and where do i get the NLog.config for uipath?

It’s in the installation folder for Professional Edition, don’t know about Community.

NLog.Config is located in C:\Users\mihai\AppData\Local\UiPath\app-xxxx.z.yyy but it will get change with any subsequent update.

1 Like