Preheat a large cooking pan with oil, over medium-low heat. Add sliced onions and sprinkle with a little bit of sugar and some salt. Stir well. Cook slowly (medium-low heat), stirring often, as the onions caramelize to nice brown color. It can take about 20-25 minutes. Set aside when done.
Grease the pan and leave the heat on medium low.
Lay all slices of bread in the pan. Divide sliced Gruyere cheese among all 4 bread slices, covering them evenly.
Divide blue cheese crumbles among two slices of bread and divide caramelized onions among the other two slices of bread.
Cover and cook just until cheese starts to melt. Once cheese is mostly melted, place slices of bread with blue cheese crumbles on top of bread with caramelized onions. Cook for another minute or so and serve.
(If using pecans, add them to the slices with caramelized onions.)