{"action":"created","issue":{"url":"https://api.github.com/repos/Unitech/pm2/issues/3440","repository_url":"https://api.github.com/repos/Unitech/pm2","labels_url":"https://api.github.com/repos/Unitech/pm2/issues/3440/labels{/name}","comments_url":"https://api.github.com/repos/Unitech/pm2/issues/3440/comments","events_url":"https://api.github.com/repos/Unitech/pm2/issues/3440/events","html_url":"https://github.com/Unitech/pm2/issues/3440","id":293538626,"number":3440,"title":"PM2 logs in docker","user":{"login":"luisdavim","id":173006,"avatar_url":"https://avatars3.githubusercontent.com/u/173006?v=4","gravatar_id":"","url":"https://api.github.com/users/luisdavim","html_url":"https://github.com/luisdavim","followers_url":"https://api.github.com/users/luisdavim/followers","following_url":"https://api.github.com/users/luisdavim/following{/other_user}","gists_url":"https://api.github.com/users/luisdavim/gists{/gist_id}","starred_url":"https://api.github.com/users/luisdavim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luisdavim/subscriptions","organizations_url":"https://api.github.com/users/luisdavim/orgs","repos_url":"https://api.github.com/users/luisdavim/repos","events_url":"https://api.github.com/users/luisdavim/events{/privacy}","received_events_url":"https://api.github.com/users/luisdavim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-01T13:55:22Z","updated_at":"2018-02-01T14:27:35Z","closed_at":null,"author_association":"NONE","body":"## What's going wrong?\r\nMy application logs are going to the PM2 logs (`/root/.pm2/pm2.log`) instead of standard output.\r\n\r\n## How could we reproduce this issue?\r\n\r\nRun PM2 in docker, using the `pm2-runtime` binary with the following process file:\r\n```\r\n/ # cat /opt/pm2.json\r\n{\r\n  \"apps\": [{\r\n    \"name\": \"ux\",\r\n    \"script\": \"npm\",\r\n    \"args\": \"start\",\r\n    \"cwd\": \"/opt/ux\",\r\n    \"log_date_format\": \"YYYY-MM-DD HH:mm Z\",\r\n    \"pid_file\": \"/tmp/ux_pm2.pid\",\r\n    \"log_type\": \"raw\",\r\n    \"log_file\": \"/dev/null\",\r\n    \"out_file\": \"/dev/null\",\r\n    \"error_file\": \"/dev/null\"\r\n    \"merge_logs\": true,\r\n    \"instances\": 1,\r\n    \"exec_mode\": \"cluster\",\r\n    \"max_restarts\": 10,\r\n    \"restart_delay\": 1000\r\n  }]\r\n}\r\n```\r\n\r\n## Supporting information\r\n\r\nI've tried different combinations for the log configuration and nothing works, If I try for example, to set the `error_file` and `out_file` to `/dev/stdout` or `/dev/fd/1` I get an error from `event.js` because it's trying to seek in the log file and you can't do that with `stdout` or `stderr`, I've even tried omitting any log related configuration from my process file and let PM@ use the defaults and I still got the same result.\r\n\r\nI'm using `keymetrics/pm2:8-alpine` as my base image to run my application and the application uses the `bunyan` lib to write the logs.\r\n\r\nIs there a way to completely disable log handling on PM2 and just let it pass everything to stdout?\r\n\r\nAs you can see in the output below my application logs are in `/root/.pm2/pm2.log` and I get nothing in stdout.\r\n\r\nPlease run the following command (available on PM2 >= 2.6)\r\n\r\n```\r\n$ pm2 report\r\n===============================================================================\r\n--- PM2 REPORT (Thu Feb 01 2018 13:35:35 GMT+0000 (UTC)) ----------------------\r\n===============================================================================\r\n--- Daemon -------------------------------------------------\r\npm2d version         : 2.9.3\r\nnode version         : 8.9.4\r\nnode path            : undefined\r\nargv                 : /usr/local/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js\r\nargv0                : node\r\nuser                 : undefined\r\nuid                  : 0\r\ngid                  : 0\r\nuptime               : 7min\r\n===============================================================================\r\n--- CLI ----------------------------------------------------\r\nlocal pm2            : 2.9.3\r\nnode version         : 8.9.4\r\nnode path            : undefined\r\nargv                 : /usr/local/bin/node,/usr/local/bin/pm2,report\r\nargv0                : node\r\nuser                 : undefined\r\nuid                  : 0\r\ngid                  : 0\r\n===============================================================================\r\n--- System info --------------------------------------------\r\narch                 : x64\r\nplatform             : linux\r\ntype                 : Linux\r\ncpus                 : Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz\r\ncpus nb              : 4\r\nfreemem              : 516497408\r\ntotalmem             : 2095816704\r\nhome                 : /root\r\n===============================================================================\r\n--- PM2 list -----------------------------------------------\r\n┌──────────┬────┬─────────┬─────┬────────┬─────────┬────────┬─────┬───────────┬──────┬──────────┐\r\n│ App name │ id │ mode    │ pid │ status │ restart │ uptime │ cpu │ mem       │ user │ watching │\r\n├──────────┼────┼─────────┼─────┼────────┼─────────┼────────┼─────┼───────────┼──────┼──────────┤\r\n│ ux       │ 0  │ cluster │ 134 │ online │ 1       │ 2m     │ 0%  │ 38.9 MB   │ root │ disabled │\r\n└──────────┴────┴─────────┴─────┴────────┴─────────┴────────┴─────┴───────────┴──────┴──────────┘\r\n===============================================================================\r\n--- Daemon logs --------------------------------------------\r\n/root/.pm2/pm2.log last 20 lines:\r\nPM2        | {\"name\":\"API\",\"hostname\":\"6bad7132cad2\",\"pid\":145,\"level\":50,\"err\":{\"message\":\"listen EADDRINUSE :::8003\",\"name\":\"Error\",\"stack\":\"Error: listen EADDRINUSE :::8003\\n    at Object._errnoException (util.js:1022:11)\\n    at _exceptionWithHostPort (util.js:1044:20)\\n    at Server.setupListenHandle [as _listen2] (net.js:1351:14)\\n    at listenInCluster (net.js:1392:12)\\n    at Server.listen (net.js:1476:7)\\n    at setServer (/opt/ux/helpers/server.js:94:21)\\n    at nextTask (/opt/ux/node_modules/async/dist/async.js:5297:14)\\n    at next (/opt/ux/node_modules/async/dist/async.js:5304:9)\\n    at /opt/ux/node_modules/async/dist/async.js:906:16\\n    at /opt/ux/helpers/server.js:61:13\\n    at nextTask (/opt/ux/node_modules/async/dist/async.js:5297:14)\\n    at Object.waterfall (/opt/ux/node_modules/async/dist/async.js:5307:5)\\n    at exports.instance (/opt/ux/helpers/server.js:59:11)\\n    at /opt/ux/helpers/server.js:357:9\\n    at new Promise (<anonymous>)\\n    at Object.exports.start (/opt/ux/helpers/server.js:356:25)\\n    at Object.<anonymous> (/opt/ux/index.js:2:8)\\n    at Module._compile (module.js:643:30)\\n    at Object.Module._extensions..js (module.js:654:10)\\n    at Module.load (module.js:556:32)\\n    at tryModuleLoad (module.js:499:12)\\n    at Function.Module._load (module.js:491:3)\",\"code\":\"EADDRINUSE\"},\"msg\":\"listen EADDRINUSE :::8003\",\"time\":\"2018-02-01T13:33:25.279Z\",\"v\":0}\r\nPM2        | Initiated mongo environment:  app\r\nPM2        | Initiating log mongo:  mongodb://DB_USER:DB_PASSWD@DB_SERVER:DB_PORT/logs\r\nPM2        | Initiated mongo environment:  log\r\nPM2        | Oauth service configured.\r\nPM2        | Plan constants got set.\r\nPM2        | PubNub got set.\r\nPM2        | Authy got set.\r\nPM2        | Google got set.\r\nPM2        | Setting exit processes.\r\nPM2        | Exit processes got set.\r\nPM2        | {\"name\":\"API\",\"hostname\":\"6bad7132cad2\",\"pid\":145,\"level\":30,\"msg\":\"Server started.\",\"time\":\"2018-02-01T13:33:25.828Z\",\"v\":0}\r\nPM2        | (node:145) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Issue with 'Authy' configuration.\r\nPM2        | (node:145) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.\r\nPM2        | (node:145) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Issue with 'Authy' configuration.\r\nPM2        | POST /enterprise/v1/fetchconfig 200 4.402 ms - 503\r\nPM2        | GET /customCss 200 3.414 ms - 2\r\nPM2        | {\"name\":\"API\",\"hostname\":\"6bad7132cad2\",\"pid\":77,\"level\":50,\"error\":\"UNAUTHENTICATED_USER\",\"req\":{\"url\":\"/currentUser\",\"params\":{},\"body\":{\"authtoken\":\"fl81526c54d970294bca35c4\"},\"query\":{},\"method\":\"GET\",\"authtoken\":\"fl81526c54d970294bca35c4\"},\"step\":\"01\",\"function\":\"handleOldSessions\",\"authtoken\":\"fl81526c54d970294bca35c4\",\"msg\":\"\",\"time\":\"2018-02-01T13:33:31.880Z\",\"v\":0}\r\nPM2        | {\"name\":\"API\",\"hostname\":\"6bad7132cad2\",\"pid\":77,\"level\":50,\"error\":{\"message\":\"Login Required.\",\"code\":401},\"msg\":\"\",\"time\":\"2018-02-01T13:33:31.880Z\",\"v\":0}\r\nPM2        | GET /currentUser 401 4.723 ms - 50\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/Unitech/pm2/issues/comments/362281628","html_url":"https://github.com/Unitech/pm2/issues/3440#issuecomment-362281628","issue_url":"https://api.github.com/repos/Unitech/pm2/issues/3440","id":362281628,"user":{"login":"vmarchaud","id":2820968,"avatar_url":"https://avatars3.githubusercontent.com/u/2820968?v=4","gravatar_id":"","url":"https://api.github.com/users/vmarchaud","html_url":"https://github.com/vmarchaud","followers_url":"https://api.github.com/users/vmarchaud/followers","following_url":"https://api.github.com/users/vmarchaud/following{/other_user}","gists_url":"https://api.github.com/users/vmarchaud/gists{/gist_id}","starred_url":"https://api.github.com/users/vmarchaud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmarchaud/subscriptions","organizations_url":"https://api.github.com/users/vmarchaud/orgs","repos_url":"https://api.github.com/users/vmarchaud/repos","events_url":"https://api.github.com/users/vmarchaud/events{/privacy}","received_events_url":"https://api.github.com/users/vmarchaud/received_events","type":"User","site_admin":false},"created_at":"2018-02-01T14:27:35Z","updated_at":"2018-02-01T14:27:35Z","author_association":"COLLABORATOR","body":"Could you try without these lines ? \r\n```\r\n    \"log_file\": \"/dev/null\",\r\n    \"out_file\": \"/dev/null\",\r\n    \"error_file\": \"/dev/null\"\r\n    \"merge_logs\": true,\r\n```"}}
{"actor":{"display_login":"vmarchaud"}}