Documentation
Getting Started
Data Grid
Modeling
Business Rules
Approvals
Users, Roles & Security
Integration & API
Installation
Migrating from MDS
Architecture

Error Log

The error log holds server errors, warnings and events. It has two tabs, because Primentra logs to two places at once.

Access: Settings → Log ViewerSystem Log or Database Log

The Database Log tab with stats cards and the entry grid
The Database Log tab with stats cards and the entry grid(click to enlarge)

Two logs, one purpose

System LogDatabase Log
Stored inerrorlog.txt on the serverthe ErrorLog table
Containsevery event, alwaysonly the categories you enable
Survives a database outageYesNo
Cleaned by retentionNoYes

The file is the complete record. The database copy is the searchable one. Configure which categories reach the database on the General tab — see General Settings.

System Log tab

A bar at the top shows the file name, the line count and the file size, and downloads errorlog.txt when you click it.

The grid has five columns: Timestamp, Level, Status, Path and Message. All five sort client-side; click a header to cycle the direction.

  • Filter by level: Errors only, Warnings only or Info only
  • Search messages and paths
  • Click a row to expand the full stack trace and request body, each with a copy button
  • Refresh reloads, Export writes JSON, CSV or XLSX
  • Purge File deletes errorlog.txt and every rotation. Primentra asks first

The tab reads the last 200 lines by default, up to a maximum of 1000.

File rotation

The file rotates at 10 MB. Primentra keeps three rotations — errorlog.1.txt, errorlog.2.txt and errorlog.3.txt — so the log occupies at most about 40 MB on disk. Rotation is automatic and needs no configuration.

Database Log tab

Three cards at the top count Total, Errors and Warnings.

  • Filter by level and search messages and paths. Both run server-side
  • Sort by clicking a column header. Sorting is server-side too
  • Auto-refresh reloads the current page every 30 seconds
  • Refresh reloads once
  • Export writes the loaded page to JSON, CSV or XLSX
  • SQL Examples opens ready-made queries with copy buttons
  • Cleanup deletes entries older than 7, 14, 30, 60, 90, 180 or 365 days
  • Truncate deletes every entry. Primentra asks first

Entries are paginated server-side. Click a row to expand its detail.

Cleanup and Truncate are one-off manual actions. For the scheduled job, set Error Log Retention on the Retention tab. See Data Retention.

Technical reference

Stored procedures

ProcedurePurpose
usp_ErrorLog_WriteInserts an entry
usp_ErrorLog_GetPaginated retrieval with level, search, date and sort
usp_ErrorLog_GetStatsThe counts behind the stats cards
usp_ErrorLog_CleanupDeletes entries older than a retention period
usp_ErrorLog_TruncateDeletes every entry

Example queries

Query the ErrorLog table directly in SSMS or any SQL client. The same queries are behind the SQL Examples button.

Recent errors, last 24 hours:

SELECT TOP 50 Id, Timestamp, Level, Method, Path,
       StatusCode, Message, Duration
FROM   ErrorLog
WHERE  Timestamp >= DATEADD(HOUR, -24, GETUTCDATE())
       AND Level = 'error'
ORDER BY Timestamp DESC;

Errors grouped by path, most frequent first:

SELECT   Path, Method, COUNT(*) AS ErrorCount,
         MAX(Timestamp) AS LastOccurrence
FROM     ErrorLog
WHERE    Level = 'error'
GROUP BY Path, Method
ORDER BY ErrorCount DESC;

Slow requests over two seconds:

SELECT TOP 50 Id, Timestamp, Method, Path,
       StatusCode, Duration, Message
FROM   ErrorLog
WHERE  Duration > 2000
ORDER BY Duration DESC;

Error summary by day:

SELECT   CAST(Timestamp AS DATE) AS LogDate,
         SUM(CASE WHEN Level = 'error' THEN 1 ELSE 0 END) AS Errors,
         SUM(CASE WHEN Level = 'warn' THEN 1 ELSE 0 END)  AS Warnings,
         COUNT(*) AS Total
FROM     ErrorLog
GROUP BY CAST(Timestamp AS DATE)
ORDER BY LogDate DESC;

Search for a message:

SELECT TOP 50 Id, Timestamp, Level, Path,
       Message, Stack
FROM   ErrorLog
WHERE  Message LIKE '%your search term%'
ORDER BY Timestamp DESC;

Ready to get started?

Start managing your master data with Primentra today.

View Pricing
Error Log | Administration | Docs | Primentra