Note: Only supported in SharePoint 2010 and higher versions
Something every SharePoint developer asks for and here it is how you log to ULS from your code in SharePoint 2010. Below is a console app:
You need to add reference to Microsoft.SharePoint.dll. Very simple!
And here is our log from ULS Viewer:
The code uses the following classes:
P.S: I will update when I find out how to add a Correlation ID associated with the log entry.