Place onions and shallots in a medium sized bowl. Sprinkle with flour, pepper and salt.
In a medium stock pot melt the butter and add the onions. Toss onions in the butter until they are translucent. Add the sugar.
Turn heat to low and cover. Cook until onions are caramelized (a brown color). This will take about 45 minutes. Move onions around frequently to ensure even cooking.
Add the stock,wine, thyme, bay leaves, oregano, and garlic. Cook for about 30 minutes on low.
Turn off heat. Add cognac, Worcestershire and nutmeg. Stir and allow to sit for about 10 minutes. Add salt to taste.
Portion into oven safe bowls.
Place toasted slices of baguette on top of the soup. Sprinkle liberally with Gruyere.
Place under the broiler until the cheese begins to sizzle and turn brown. Enjoy!