This page explains logging for the default mode of the Node.js Agent.
By default, the Node.js Agent generates log information at the informational level. You can increase/decrease the logging verbosity, change the log file location, and configure other logging settings.
Node.js Agent Logging Location
The log file appears at the following location on the machine where the Node.js Agent runs:
/tmp/appd/<hash>/appd_node_agent_<datetime>.log
CODE
If you are running the Node.js Agent, <hash>
is generated by the agent.
In Windows, you can find the tmp directory with cd %tmp% d
and then look for the <hash>
directory.
To configure logging, use the logging module configuration in the Node.js require statement. You can change the level, maximum size/number of files, and mode.
The following sample shows the logging settings in default mode:
{
...
logging: {
'logfiles': [
{
'root_directory': '/tmp/appd',
'filename': 'echo_%N.log',
'level': 'TRACE',
'max_size': 5242880,
'max_files': 10,
'outputType': 'console' // Set this parameter if you want to log to STDOUT/STDERR. Omit this parameter if you want to log to a file.
}
]
}
...
}
CODE
The level determines the verbosity of logging output and can contain one of the following values listed from least to most verbose:
FATAL
ERROR
WARN
INFO
DEBUG
TRACE
By default, once the size of the logging files on disk reaches the maximum size, old logs are purged. You can reduce or increase the size, depending on your needs and the disk space available on the machine.
Debug Logging
Instead of the logging configuration above, you can use this shortcut to set DEBUG
to true, resulting in debug level logging.
The location of the debug log file is written to standard output.
See Node.js Agent Settings.