A logarithmic oscillator (in short, log-oscillator) behaves like an ideal thermostat because of its infinite heat capacity: When it weakly couples to another system, time averages of the system observables agree with ensemble averages from a Gibbs distribution with a temperature T that is given by the strength of the logarithmic potential. The resulting equations of motion are Hamiltonian and may be implemented not only in a computer but also with real-world experiments, e.g., with cold atoms.