If you're using version 2.7 or later, what about this?
<? if (is_user_logged_in()): ?>
<a href="<?=wp_logout_url()?>">Log Out</a>
<? endif; ?>
or (if you want both log in and log out links):
<? if (is_user_logged_in()): ?>
<a href="<?=wp_logout_url()?>">Log Out</a>
<? else: ?>
<a href="<?=wp_login_url()?>">Log In</a>
<? endif; ?>
Note that you can give wp_logout_url() and wp_login_url() a single string argument containing a URL to which WordPress will redirect the visitor after login/logout.
Another Option
If you want the default WordPress login/out link without the ability to customize the HTML and are using at least version 1.5, try wp_loginout():
<p><?=wp_loginout()?></p>
(Again, you can optionally provide a string URL redirect-to argument.)
Hope this helps,
Ben