logging (logging options)
This setting was added in Profound.js 7.6.0.
When using this option to write stdout/stderr log files from within the process (the default) and starting the instance with STRTCPSVR on IBM i, the STRTCPSVR instance configuration option logging=0 should be used to avoid duplicate log files.
This option controls logging and log file rotation. The default value is:
logging: {
stdout: {
enabled: true,
interval: "1d", // Rotate the file at every midnight.
maxFiles: 7, // Keep 7 rotated files.
maxSize: "256M", // Maximum size of rotated files to keep.
compress: false, // Compress rotated files.
timestamp: true, // Prefix each entry with timestamp.
sessionId: true, // Prefix each entry with session id.
opts: {} // Log type-specific options. None in this case.
},
stderr: {
enabled: true,
interval: "1d",
maxFiles: 7,
maxSize: "256M",
compress: false,
timestamp: true,
sessionId: true,
opts: {}
},
access: {
enabled: true,
interval: "1d",
maxFiles: 7,
maxSize: "256M",
compress: false,
timestamp: false,
sessionId: false,
opts: {
format: ':date[iso] :remote-addr - :remote-user ":method :url HTTP/:http-version" :status :res[content-length]'
}
},
license: {
enabled: true,
interval: "1d",
maxFiles: 7,
maxSize: null,
compress: false,
timestamp: true,
sessionId: true,
opts: {}
},
ai_chat: {
enabled: true,
interval: "1d",
maxFiles: 7,
maxSize: null,
compress: false,
timestamp: false,
sessionId: false,
opts: {}
},
sessions: {
enabled: true,
interval: "1d",
maxFiles: 7,
maxSize: "256M",
compress: false,
timestamp: false,
sessionId: false,
opts: {}
}
}
The top-level keys correspond to log files written by Profound.js:
stdout: Process standard output. This includes output of calls to console.log() and process.stdout.write().
stderr: Process standard error. This includes output of calls to console.error() and process.stderr.write().
access: HTTP request log. Includes one line of output for each HTTP request handled by the server. Similar in concept to Apache HTTP server access log.
license: Profound.js license log. Includes output relating to floating license seat activation/deactivation.
ai_chat: Profound AI chat log. Records conversations with any/all Profound AI agents.
sessions: Records an entry for each Rich Display File application session start/end and associated IBM i job details.
Each top-level key can be set to an object that controls the options for the given log type:
enabled: Set to false to disable the log. Note: For stdout/stderr, disabling the log only turns off writing log files from within the Profound.js process. Output will still be written to the process’s stdout/stderr streams and will still be visible to the controlling process – such as a process manager, terminal window, VS Code debug console, etc.
interval: Interval at which to rotate log files. Must be set to a string containing a positive integer followed by one of these suffixes:
s: seconds
m: minutes
h: hours
d: days
maxFiles: Maximum number of rotated files to retain. Can be set to a positive integer or null (no max).
maxSize: Maximum size of rotated files to retain. Set to null (no max), or a string containing a positive integer followed by one of these suffixes:
B: bytes
K: kilobytes
M: megabytes
G: gigabytes
compress: Set to true to compress rotated files.
timestamp: When set to true, all log entries will be prefixed with a UTC timestamp at the time the entry is written. Set to false to disable. Note: Some log types (such as access and ai_chat) may embed timestamps in to the entries themselves, and so this option may conflict with some log types.
sessionId: When set to true, all log entries will be prefixed with a session id following the timestamp, if any. Entries that don’t pertain to a session will have a hyphen in place of the session id. Set to false to disable. Note: Some log types (such as ai_chat) may embed session ids into the entries themselves and so this option may conflict with some log types.
opts: Can be set to control options that are specific to each individual log type:
For access log:
format: Set to the desired log format string for the underlying access logger package, morgan.
Log files are written to the directory specified by the logDirectory configuration option.
Examples
To adjust the default settings, it’s only necessary to provide the log type keys and options that you want to change.
For example, to disable stdout/stderr log files:
logging: {
stdout: {
enabled: false
},
stdout: {
enabled: false
}
}
To change the number of retained access log files to 14:
logging: {
access: {
maxFiles: 14
}
}
Some documentation pages have recently moved to a new section: Profound AppDev. If you are having trouble finding specific pages, try the documentation search capability or reach out to our Support team!