I'll differ with Doug on one legal point. The Chief Counsel said a long time ago that there is no compensation issue with a PP safety pilot receiving free flight time, so it doesn't matter who's acting as PIC, and they can split the costs any way they like, from 100/0 to 0/100 or anything in between.
A private pilot, acting as PIC while filling the role of safety pilot, is the acting pilot in command. A private pilot, acting as pilot in command, may not do so for compensation or hire, and must pay his or pro rata share of the flight.
A private pilot who is acting as PIC while fulfilling the role of safety pilot, who pays nothing toward the flight, is still pilot in command. The FAA has held repeatedly that even the logging of that flight time is considered compensation. The private pilot acting as PIC must pay his or pro rata share of the flight, and cannot act for compensation or hire. If he or she doesn't pay the pro rata share (e.g., one half of the cost of the flight if only the two pilots are aboard), then he or she does run afoul of the regulation. If the other pilot pays the costs of the flight but does not compensate the safety pilot while the safety pilot is acting as PIC, then the PIC is considered to be compensated simply by the logging of the flight time.
Also, I doubt any employer really feels that logging SIC safety pilot time "looks bad," although I believe many air carriers simply don't count it towards their own hiring requirements. In addition, that time has significant value towards CP and ATP certificates for the FAA. All in all, I'd say "log away," but when you fill out a pilot employment application, include only the time that employer says they want to see.
Logging second is command isn't bad, but a lot of employers will shake their head at someone doing so in a 172. Having very much safety pilot time also looks bad. It has the appearance of padding the logbook, simply as safety pilot time. Logging the time as SIC makes the pilot look bad, however legal it may be, if it's not in an aircraft requiring two pilots. (a crew aircraft).
It's a little like the guy that gets type rated and is sole manipulator of the controls on his leg, but who hasn't served as captain, logging PIC. The regulation says you can do it, but you'll only be embarrassing yourself by doing so. Simply because you can log it doesn't mean you should. If you never plan on going father with your flying than being a private pilot, that's fine. If you do, logging SIC in the 172 looks ridiculous and makes the person logging the time look ridiculous (about the same as wearing around a shirt with epaulets and bars as "captain" in a 172).