I would like to log out all my "set -x" output into my syslog file. However, the syslog file has my own custom format.
But set -x output does not have formatting.
How can I do that?
I would like to log out all my "set -x" output into my syslog file. However, the syslog file has my own custom format.
But set -x output does not have formatting.
How can I do that?
If you look at
print_cmd.c
in the Bash source code, you'll see that the format ofset -x
output is not configurable.You could trap the
DEBUG
"signal" to implement your own custom logging, e.g.to send all commands to syslog with facility
user
, leveldebug
, and tagSHELLSCRIPT
.