jlog, jtool log
A platform agent tool used to log using the Redwood Logging format. You can call it as jlog
or jtool log
Syntax
jlog [-h|-?|-help] [-l <loglevel>] [-f <logfile>] [-e|-exit <value>] [-c|-category <category>]
[-n|-name <name>] <level> <message> ...
Argument | Default | Description |
---|---|---|
-h, -?, -help | Show usage and exit. | |
-l <loglevel> | ${JCS_LOGLEVEL:-info} | Set the logging level; defaults to environment variable ${JCS_LOGLEVEL} or info when the environment variable is not set. |
-f <logfile> | ${JCS_LOGFILE:-stderr} | Log to file instead of stderr; defaults to environment variable ${JCS_LOGFILE} or stderr when the environment variable is not set. |
-j, -job-context | Obtain environment from job-context | |
-e,-exit <value> | Exit with given return code | |
-c, -category <category> | ${JCS_LOG_CATEGORY:-custom.log} | Category |
-n, -name <name> | ${JCS_LOG_NAME:-jlog} | Name of the component |
<level> | Log level | |
<message> | Message to log |
Process Server Parameters and Environment Variables
You use the ${<name>}
syntax to specify process server parameter values; note that if you shell interprets ${<val>}
then you will have to escape the expression according to your shell. Any process server parameter that has remote
set to true
can be accessed in this way. The special ${LISTALL}
variable contains a list of all environment variable and process server parameters.
jtool log -n myTool -j 'DataRootDirectory: ${DataRootDirectory}'
This can be used outside of job-context
, however, only environment variables are available.
note
jlog
expects a correctly escaped [environment] variable name for your shell, you must ensure the shell does not evaluate the variable. Numerous examples are available below.
Example
The LogLevel process server parameter is set to jlog.my.category=debug
The following UNIX shell example shows how to log
jlog -n myproject -c my.category debug "This will be printed to the log"
jlog -n myproject -c my.category info "This will be printed to the log"
jlog -n myproject -c my.other.category debug "This will NOT be printed to the log; the category does not match"
jlog -n myproject -c my.category trace "This will NOT be printed to the log, the verbosity level is too high"
jlog -n myproject -c my.category info "This will be printed to the log, mentioning the value ${BustWatchDirectory} of the process server parameter with the name BustWatchDirectory"