简体   繁体   中英

Where is the standard output and error output being redirected by mongodb-mms-automation agent?

Sorry for my noob question as I am very new to linux. Please consider the below linux command :

/opt/mongodb-mms-automation/bin/mongodb-mms-automation-agent 
-f /etc/mongodb-mms/automation-agent.config 
-pidfilepath /var/run/mongodb-mms-automation/mongodb-mms-automation-agent.pid 
>> /var/log/mongodb-mms-automation/automation-agent-fatal.log 2>&1

According to my understanding >> redirects standard output to file and 2>&1 means that standard error will be redirected to the same location as standard output. So in the above case I expect the standard output and standard error both to be redirected to /var/log/mongodb-mms-automation/automation-agent-fatal.log .

But obviously this is not the case. I can see that all info / error messages are being redirected to a file /var/log/mongodb-mms-automation/automation-agent.log . Can someone please explain what error I am making in reading this command?

Regards,

Meena

Standard output and standard error are just default destinations; the program could be doing a number of things which will sabotage any attempts to save the logs by redirecting to a file:

  • It writes straight to the terminal output, such as /dev/pts/0.
  • It detects whether standard output/error are connected to a file or a terminal, and changes behaviour accordingly.
  • Anything else the application developer considered to be the most useful behaviour.

In other words, it's application specific. You're probably better off finding the logfile configuration setting and changing that if you really need to. Usually I find it's easier and safer to leave the defaults (since they may be handy for example for security reasons such as sandboxing) and instead pointing to the default location in whatever software is trying to process that file in some way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM