How to send business exception logs to custom table in database?
Query:
How to send business exception logs to a custom table in the database?
Use Case:
If a customer prefers to store business exception logs in a dedicated database table instead of the standard event logs, they can follow the steps below to configure it.
Step 1: Configure the Logger in UiPath Orchestrator
- Navigate to the UiPath.Orchestrator.dll.config file located at C:\Program Files (x86)\UiPath\Orchestrator
- Add the following logger configuration under the section:xml:
Step 2: Create a Custom Table in the UiPath Primary Database
- Execute the following SQL script to create a custom table named EventLogs in the UiPath primary database:
CREATE TABLE [dbo].[EventLogs](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[Timestamp] [datetime] NOT NULL,
[Level] [int] NOT NULL,
[Message] [nvarchar](max) NULL,
[Exception] [nvarchar](max) NULL)
Step 3: Configure the Target to Send Logs to the Custom Database Table
- In the UiPath.Orchestrator.dll.config file, locate the section.
- Include the following target configuration to send logs to the newly created database table:
INSERT INTO dbo.EventLogs (Timestamp, Level, Message, Exception)
VALUES (@timestamp, @level, @message, @exception)
Step 4: Update the Logger Configuration
- Modify the existing logger configuration as follows to send business exception logs to both the custom database table and the standard event logs:
Summary:
By following these steps, business exception logs can be redirected from the default event logs to a custom table in the UiPath primary database, enabling more granular control and monitoring of exceptions.