Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the following commands to run my application:

screen node cam.js 

What I want to do is write the output to a log file to catch a certain error that's happening and I need to have logs to find the cause of it. I tried using:

screen node cam.js > output.txt


screen "node cam.js > output.txt"

I think it's not working because of screen. What am I missing? I'm not really that experienced with Ubuntu, ofcourse I tried using Google, but I wouldn't ask if I couldn't find or without trying anything!

share|improve this question
Do you really need to run that command in screen? Screen provides the ability to use and switch between multiple consoles within one. I suppose you want to run that script persistently, then look at program called nohup man nohup. But just for testing, if there is a problem in output, run node directly node cam.js > output.txt. – week Dec 17 '12 at 18:09
If what you are catching is actually being written as an error (i.e. to standard error rather than standard out), you will need to capture the output of standard error, not just tandard out, as you currently showing. – Kazark Dec 17 '12 at 18:20
@week I'm running another application next to my node application. – Fabian Pas Dec 17 '12 at 18:25
@Kazark I think the error is standard out, if it's not I'll try something else! – Fabian Pas Dec 17 '12 at 18:26
up vote 3 down vote accepted

I believe that if you look at the man page for screen(1), you'll find that there are parameters and screen commands that provide for creation of a log file and enabling and disabling it.

share|improve this answer
Oh yeah! Didn't think of that! screen -L did it for me! – Fabian Pas Dec 17 '12 at 18:06

mdpc is correct, and the option when starting screen is screen -L.

From within screen, C-a H turns logging on or off. The logfile will be called screenlog.N (where N is some integer).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .