Using Node fs.createWriteStream to produce logs, but it is writing duplicates

I am using Node 0.6.19 with express framework. I am seeing some weird things with my logging. First, I created a log for (createWriteStream) incoming requests. I used the express syntax to pipe the requests into the log via:

var logFile = fs.createWriteStream('log.log', {
    "flags": "a"
});

app.configure(function() {
    app.use(express.logger({
      stream: logFile
    }));
    app.use(express.bodyParser());
    app.use(express.cookieParser());
    app.use(express.methodOverride());
    return app.use(app.router);
});

seems to have duplicates of the incoming request when I hit an express route like:

app.get('/', routes.index);

Second, on some of my routes I do a user lookup in the database, and log the user id to another file by the same createWriteStream method. When I do a

logFile.write(user_id + 'n');

I get duplicate user_id. Not a problem with the query itself which tells me something is going on with the createWriteStream method.

If using a browser to call your app, you are possibly getting the duplicate output as a result of the favicon request. You can easily validate this by intercepting the request using fiddler or some alternative HTTP debugging proxy depending on your OS.