View logs for a container or service

How to write to and view a container's logs