当前位置:网站首页>Chapter 10 setting up structured logging (2)

Chapter 10 setting up structured logging (2)

2022-06-26 13:17:00 yaoxin521123

Chapter ten Set up structured logging ( Two )

notes :IRIS Yes ,Cache nothing .

Enable structured logging

^LOGDMN Routines allow you to manage structured logging ; There is also a class based API, It will be introduced in the next section .

To use ^LOGDMN Enable structured logging :

  1. Open the terminal and enter the following command :
set $namespace="%sys"
do ^LOGDMN

This will start a routine with the following prompts :

 
1) Enable logging
2) Disable logging
3) Display configuration
4) Edit configuration
5) Set default configuration
6) Display logging status
7) Start logging
8) Stop logging
9) Restart logging
 
LOGDMN option?
  1. Press 4 So that you can specify the configuration details . then , The routine prompts for the following items :

a. Minimum log level , One of the following :

  • -2 — Detailed debug messages ( For example, hexadecimal dump ).
  • -1 — Less detailed debug messages .
  • 0 — Informational messages , Including all audit events .
  • 1( The default value is )— Warning , Indicates a problem that may require attention but does not interrupt the operation .
  • 2 — Serious mistakes , Indicates that the problem has interrupted the operation .
  • 3 — Fatal error , Indicates that the system cannot run due to the problem .

b. Pipeline command , It specifies where the system sends structured logs . Enter a response in the following form :

irislogd -f c:/myfilename.log

But will c:/myfilename.log Replace with the fully qualified pathname of the target log file . In this order ,irislogd yes The name of the executable , It will receive the log data and write it to the specified file ( adopt -f Options ).

For pipeline commands , The simplest choice is to use the executable file mentioned here (irislogd.exe), But it can be replaced with a different goal .

c. The format of the data sent to the pipeline . Appoint NVP( Default ) or JSON. Options NVP Sent by name - Data composed of value pairs , Space off . Options JSON stay JSON Send data in output .

d. The interval between successive calls to pipeline commands ( In seconds ). The default value is 10 second .

When the routine displays the main prompt again (LOGDMN Options ?), Press 1 Enable logging .

Press 7 Start recording .

 Insert picture description here

 Insert picture description here

 Insert picture description here

 Insert picture description here

Class based for structured logging API

To manage structured logging , have access to %SYS In namespace SYS.LogDmn class , Instead of using ^LOGDMN routine .

irislogd Other options for

ArgumentPurpose
-d Send diagnostic and error messages
-eerrfilename Write error and diagnostic messages to the given file .
-flogfilename Write log messages to the given file .
-hhostname Include the given hostname in the structured log file .
-iirisinstance Include the given instance name in the structured log file .
-s Write log messages to Unix syslog Tools ( Limited to Unix

Besides , You can write output to standard output . To be in Unix On the implementation , Please also omit -f and -s Parameters . To be in Windows Do this on , Please omit -s Parameters .

原网站

版权声明
本文为[yaoxin521123]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206261203165893.html