How do I see logs on parse-server?
Asked Answered
E

6

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?

Eyrie answered 3/3, 2016 at 15:44 Comment(1)
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.Congratulant
E
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).

Exogenous answered 28/3, 2016 at 8:22 Comment(1)
what do you mean by PM2?Night
P
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

Philina answered 7/3, 2016 at 23:27 Comment(1)
Yep, that's what I've been doing. No logs! Plz help ;)Eyrie
O
3

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

enter image description here

Octagon answered 25/8, 2016 at 7:55 Comment(2)
Oooh that is nice.Eyrie
this is what i get at the moment: When you start using Cloud Code, your logs will show up here. Learn more Equites
E
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

Emanate answered 7/3, 2016 at 7:28 Comment(3)
Thanks for this, I am looking for a way to see logs while my code is running on Heroku as well though.Eyrie
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.Equites
Console.log has issues sometimes, rather use console.infoMerbromin
I
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

Interne answered 27/2, 2020 at 9:46 Comment(1)
#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 } ```Rockfish
E
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

Earnestineearnings answered 20/9, 2020 at 20:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.