Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

and

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
1  
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
add comment

2 Answers

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
1  
Oh yeah! Didn't think of that! screen -L did it for me! –  Fabian Pas Dec 17 '12 at 18:06
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.