A log is the trunk of a tree minus the branches: logging is cutting down trees. A log is also a written record of something, and logging is keeping such a record.
The first type of log is a tree that's been cut down with the branches stripped. Think of a log cabin: it's made up of logs. Logging is when trees are cut down for lumber. The other type of log is some type of written record or list of messages. A ship captain keeps a log of notes on the ship's status and progress. When you make such a record, you're logging. Logging can be written or orally recorded.