When does iisnode create stdout log files? - javascript

I'm deploying my first node app and running into some issues. I am using iisnode and can see that it writes stdout log files which contain useful console logs from my app. What triggers these log files to be written? Just trying to get a handle on how they are born in an attempt to can get a handle on what's going on!

Related

Node.js Logging to File deleting old log on restart

I have a Node.js Application that I execute with systemctl start app.service on my server.
I configured my package.json correctly that on app start the log is being written in app.log with
node app.js > app.log 2>&1 the problem is now that with every restart the old log is being deleted and a new one is genereted. I want to keep my old log data for debugging purposes. How can I edit the log statement that the old log will be saved or the new log just appended? Is this possible?
I already searched in Stackoverflow and Google for a solution but did not find one. I was expecting to keep my old logs.
When using IO redirection, if you want to append to a file rather than overwrite the file, you need to use ">>" instead of ">". For example:
node app.js >> app.log

MONGO_URL for running multiple Meteor apps on one server

I have one Meteor application running on my Ubuntu server (Digital Ocean). I use Meteor Up (MUP) to deploy and keep the app running. Everything works fine.
However, when I try to deploy a second app on the same server, something goes wrong in connecting to the MongoDB. I get a long and unreadable error message that starts "Invoking deployment process: FAILED" and then ends with
Waiting for MongoDB to initialize. (5 minutes)
connected
myapp start/running, process 25053
Waiting for 15 seconds while app is booting up
Checking is app booted or not?
myapp stop/waiting
myapp start/running, process 25114
And the app refuses to run. I have tried a number of things to fix this and will edit this post if more info is requested, but I'm not sure what's relevant. Essentially I don't understand the Error message, so I need to know what the heck is going on?
EDIT:
I want to add that my app runs fine if I go into the project folder and use the "meteor" command. Everything runs as expected. It is only when I try to deploy it for long-term production mode with MUP that I get this error.
EDIT:
I moved on to trying mupx instead of mup. This time I can't even get past the installation process, I get the following error message:
[Neal] x Installing MongoDB: FAILED
-----------------------------------STDERR-----------------------------------
Error response from daemon: no such id: mongodb
Error: failed to remove containers: [mongodb]
Error response from daemon: Cannot start container c2c538d34c15103d1d07bcc60b56a54bd3d23e50ae7a8e4f9f7831df0d77dc56: failed to create endpoint mongodb on network bridge: Error starting userland proxy: listen tcp 127.0.0.1:27017: bind: address already in use
But I don't understand why! Mongod is clearly already running on port 27017 and a second application should just add a new database to that instance, correct? I don't know what I'm missing here, why MUP can't access MongoDB.
It's tricky without your mup.json to see what's going on here. Given what you said, it looks like your 2nd app deployment tries to override/boot mongodb over the 1st one which is locked, the mongodb environment fails to boot, causing then the fail. You should tackle this different ways:
If your objective is to share your mongoDB, point the MONGO_URL from your 2nd mup.jon on your first mongodb instance. It's generally something along the 2701X ports. As it's a shared DB, changes in one database could affect the other.
meteor-up oversees the deployment of your app from a meteor-nice-to-test thing to a node+mongodb environment. You can spawn another mongod instance with :
mongod --port 2701X --dbpath /your/dbpath --fork --logpath /log/path on your DO server and then point MONGO_URL there.
Last but not least, mupx having docker under the hood. Using mupx for your deployments should isolate both apps from each other.

Node.js Forever.js uptime stopped

I'm running a node script on my EC2 instance. I 'm using forever.js to run it because I'd like to run it even when I disconnect from my SSH connection.
I run:
forever start app.js
and then list running processes using:
forever list
and for uptime is says STOPPED no matter what I do.
ubuntu#ip-xx-xxx-xxx-xxx:~$ forever list
info: Forever processes running
data: uid command script forever pid id logfile uptime
data: [0] 79f1 /usr/local/bin/node app.js 17099 17100 /home/ubuntu/.forever/79f1.log STOPPED
You could just run forever logs yourfile.js to see logs. If you need to be sure that you are seen the right logs.
I checked the log file mentioned (duh!) /home/ubuntu/.forever/79f1.log and that had the error.
Turns out, it was a simple path error in my app.js script. I was using a file which wasn't in the same directory from which I ran forever start app.js. So it actually had nothing to do with forever.js, but was a simple path error where node couldn't find a file. Thank goodness for log files!

How to monitor server-side log when using Meteor and Meteor Up

I'm using Meteor and Meteor UP for deployment.
So far so good.
I can deploy my project to my test Ubuntu server.
My problem is I don't know how to debug on server.
If I use node.js and express, I can just write console.log("some error") to see logs.
The log file seems /var/log/upstart/.log
But I could only find
>> stepping down to gid: meteoruser
>> stepping down to uid: meteoruser
Is there any way to output "console.log(something)" ?
I use Ubuntu-14.04 and Meteor 1.1.0.2.
Yes, there is. Do console.log(something) as you normally would in your server-side code. Then from the Ubuntu server in your meteor-up directory (same place where you do mup deploy), do mup logs -f
That will allow you to monitor the logs in real-time.
UPDATE: For those using the new mupx, you can check the logs with mupx logs -f
(ref)

Console.log is not working in Qunit tests with grunt server

I am creating Qunit tests which are running on grunt server. In the test when I am trying to use "console.log" to log some output to the console, it is not printing anything in the console.
Currently I am able to use only OK to perform the assertions.
Please give your inputs.
If you are using the qunit task in grunt, you need to start the task with --debug (i.e. grunt test --debug). You will then see phantom logs printing out your console logs in the following format:
[D] ["phantomjs","console","MIXPANEL PEOPLE REQUEST (QUEUED, PENDING
IDENTIFY):"]
See documentation

Categories