logs.LogSystemError
Overview¶
This is the "LogSystemError" method of the "logs Object". It displays and outputs the log in the "Server Script" as log type: SystemError.
Syntax¶
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| message | string | Yes | Specifies the error content to be displayed and output. |
| method | string | Optional. Default is an empty string. | |
| console | bool | Optional. Default is true. Specify true to display in the browser's developer tool console | |
| syslogs | bool | Optional. Default is true. Specify true to output to the system log |
Return Value¶
Returns true if the log can be displayed and output, or false if it cannot be displayed or output.
Display content when displayed on console¶
Display format¶
| Display column | Display content | Notes |
|---|---|---|
| Message | String set in message | |
| Method | String set in method | If method is not specified, square brackets ([]) are not displayed either |
Output destination column when outputting system log¶
| Output destination column | Output content | Notes |
|---|---|---|
| ErrMessage | String set in message | |
| Method | String combined with the original string recorded in Method in the format of ":method" | |
| SysLogType | 80 | Fixed to 80 (SystemError) |
Usage Examples¶
In the example below, the title of the "Limited table" for site ID 2 is "About upgrading Pleasanter" Creates a record and outputs a log if creation fails.
JavaScript¶
const siteId = 2;
const item = items.NewIssue();
item.Title = 'About upgrading Pleasanter';
const ret = items.Create(siteId, item);
if (!ret) {
logs.LogSystemError(`Failed to create record. Site ID: ${siteId}`);
}
Code Samples¶
1. A general-purpose logging function
This is a sample code of a general-purpose logger that wraps each method of the logs object so that log output can be switched between debugging and production.
Functional requirements¶
-
Output control by a debug flag
logger.debug()is output only whenDEBUG_MODE(bool) is set totrue. When it isfalse, the output is completely suppressed. -
Centralized management of output destinations
With
LOG_TARGET(bool values for console / syslogs), output to the console and to the system log can each be turned on or off individually. The settings apply to the whole script at once. -
Log levels
The following 6 methods are provided, and each delegates to the corresponding
logsmethod.Method Delegates to Always output logger.debug() LogInfo ✗ (debugging only) logger.info() LogInfo ✓ logger.warn() LogWarning ✓ logger.userError() LogUserError ✓ logger.systemError() LogSystemError ✓ logger.exception() LogException ✓
JavaScript¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
Supported Versions¶
| Suported versions | Body |
|---|---|
| 1.4.12.0 or later | Added function |