Step 1. Over medium heat, melt 2 tablespoons butter in a large frying pan. Add sliced onion and adjust heat to medium-low. Cook until onion is soft and brown, around 30 minutes, stirring every once in a while.
Step 3. Using same skillet, adjust heat to low and add remaining 2 tablespoons of butter to pan. Place two slices of sourdough in pan, and distribute cheese evenly over both slices of sourdough. Add onion mixture and place remaining 2 slices of sourdough on top.
Step 4. Cook on one side until golden brown, 5-6 minutes, then flip and cook other side for another 3-4 minutes. Remove from pan and cut in half. Serve immediately.
Go low and slow. When caramelizing onions, be sure to use a low heat setting. You don't want to fry the onions, but instead turn them into silky, soft onions that become slightly sweet.
Make in oven: Heat oil or butter in a large ovenproof skillet over medium heat. Toast both sides of bread until golden brown. Place in a 350 degree F. oven until cheese is melted and gooey.