9

Parse had a nice development command utility where you could read and stream logs.

Heroku has that, but it shows only Heroku logs, not Parse logs.

Is there some way to see a console.log or console.error statement now that we're all switching over to parse-server?

buildsucceeded
  • 4,203
  • 4
  • 34
  • 72
  • Did you get this figured out? I'm having the same issue but on Amazon. It seems that they should show up in Parse Dashboard but they aren't there for me either. – Jeremiah Apr 29 '16 at 19:17

6 Answers6

7

If you use PM2, it is really easy to see logs.

For my project, I have parse-server and parse-dashboard running on my server. Here is the PM2 config I use for them:

{
    "apps": [
        {
            "script": "parse-server",
            "args": "config/server.json",
            "log_file": "logs/server.log",
            "error_file": "logs/server-error.log",
            "log_date_format" : "YYYY-MM-DD HH:mm:ss Z",
            "instances": 1, 
            "watch": true,
            "ignore_watch": ["cloud", "logs"],
            "env": {
                "VERBOSE": "1"
            }
        },
        {
            "script": "parse-dashboard",
            "args": "--config config/dashboard.json",
            "log_file": "logs/dashboard.log",
            "error_file": "logs/dashboard-error.log",
            "log_date_format" : "YYYY-MM-DD HH:mm:ss Z",
            "instances": 1,
            "watch": true,
            "ignore_watch": ["cloud", "logs"]
        }
    ]
}

In my case, it is the "VERBOSE": "1" argument that allows me to see all the queries executed by parse-server.

If you want to see the logs of both parse-server and parse-dashboard, you then only have to type pm2 logs.

In my configuration, parse-server and parse-dashboard are installed globally (npm install -g parse-server and npm install -g parse-dashboard).

Nasedo47
  • 337
  • 3
  • 13
4

If you have Heroku CLI installed you can run these lines inside your project

heroku logs    

for the last 100 lines or

heroku logs --tail    

to show logs in real time

arxidon
  • 49
  • 3
3

The latest versions of Parse dashboard have Logs page out of the box

enter image description here

Andrey Gordeev
  • 30,606
  • 13
  • 135
  • 162
0

I dont know about how you can see logs on Heroku, but i am able to see logs locally. What you need to do is when your run your application using command => node app.js then you will be able to see all console.log(""); statements in the console.

If you want you check this link . How to setup Parse on local machine.

https://www.webniraj.com/2016/01/31/parse-com-setting-up-the-open-source-parse-api-server/.

I hope this helps.Thanks

  • 1
    Thanks for this, I am looking for a way to see logs while my code is running on Heroku as well though. – buildsucceeded Mar 07 '16 at 11:17
  • I can see some logs there. But not everything it seems. When I saw an "authorization error" while testing and went to the console, I saw other erros but no indication that someone had been denied access. – nyxee Aug 18 '17 at 00:43
  • Console.log has issues sometimes, rather use console.info – simonberry May 23 '19 at 16:54
0

here are 2 ways, in case of selfhosted parse-server:

#1 view logs by url

  • create a symbolic link of your log-folder to /public/logs
  • add this middleware:
app.get(/^\/logs*/,(req,res,next) => {
  if( req.url == '/logs/' || req.url == '/logs' )
    return res.redirect('/logs/parse-server.info.'+new Date().toISOString().slice(0,10))
  if( req.url.match(/parse-server\./) )
    res.set('content-type','text/plain') // lets hint the browser for a logfile
  next()
})

// *TODO* please run basic-auth middleware on /logs url

BOOM...now surfing to '/logs' will always redirect to the latest log-url. You can just modify the dates to go back in time.

#2 view realtime logs

see this package https://www.npmjs.com/package/express-logio

coderofsalvation
  • 1,764
  • 16
  • 13
  • #2 not working i got this error ``` { Error: connect ECONNREFUSED 127.0.0.1:6689 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14) errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 6689 } { Error: connect ECONNREFUSED 127.0.0.1:6689 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14) errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 6689 } ``` – Ahmed Wahdan Mar 02 '21 at 07:07
0

You can use request.log.info() and request.log.error() and they will be show in the parse dashboard

Cloud Code function

Log on Parse dashboard