socket.io - no info or debug data and io.set crash the server

First a little bit of code. This is the server code:

var http = require('http');
var url = require('url');
var fs = require('fs');
var io = require('socket.io');

var server = http.createServer(function(req, res){
var path = url.parse(req.url).pathname;

switch(path){
    case '/':
    res.writeHead(200, {'Content-Type': 'text/html'});
    res.end('<!DOCTYPE html><html><head><title>Learn socket.io</title><meta charset="UTF-8"></head><body><h1>OK</h1></body></html>');
    break;
case '/socket.html':
    fs.readFile(__dirname + path, 'UTF-8', function(error, data){
        if(error){
        res.writeHead(404);
        res.end('<!DOCTYPE html><html><head><title>Learn socket.io</title><meta charset="UTF-8"></head><body><h1>OEPS!!! 404 error</h1></body></html>');
    }else{
        res.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'});
        res.end(data, 'UTF-8');
    }
    });
    break;
default:
    res.writeHead(404);
    res.end('<!DOCTYPE html><html><head><title>Learn        socket.io</title><meta charset="UTF-8"></head><body><h1>OEPS!!! 404 error</h1></body></html>');
    }
});
server.listen(8001);
io.listen(server);
//io.set('log level', 1);
//io.sockets.on('connection', function(socket){
//socket.emit('message', {'content':'Server sending connection event'});
//});
console.log('Serveur started on 8001');

And the socket.html page:

<html>
    <head>
    <title>File uploader</title>
    <script src="http://localhost:8001/socket.io/socket.io.js"></script>
    <script>
        var socket = io.connect();

    socket.on('connecting', function(){
        console.log('Socket fire connecting event.');
    });

    socket.on('connect', function(){
        console.log('Socket fire connect event.');
    });

    socket.on('disconnect', function(){
        console.log('Socket fire disconnect event.');
    });

    socket.on('message', function(data){ //message, callback
        console.log(data.content);
    });

    socket.on('connect_failed', function(){
        console.log('socket could not connect.');
    });

    socket.on('error', function(){
        console.log('An error occured.');
    });

    </script>
    </head>
    <body>

    <h1>This is our new socket.html file</h1>
    </body>
</html>

There are here nothing special, only code to learn this things. Everything is ok, but when I uncomment "io.set('log level', 1);" or io.socket.on..., I cannot connect to the server anymore. Furthermore, on the command prompt (windows...) I got 'info -' or 'debug -', but nothing more and following what I see in different blogs, I should have something like this: info - socket.io started, debug - served static content /socket.io.js

Could someone say what is it wrong in my code ?

Thank you in advance, Michel

After server.listen(8001); change io.listen(server); to io = io.listen(server); to access your socket.io server instance.