Where there was no convenient moat or stream, people dug a pit, or used a removable barrel. In either case the sewage had to be removed in due course. In 1281, 13 men took five nights to clear the cloaca at Newgate Prison---on triple pay! At Hampton Court in Henry VIII's time the gongfermors had a formidable task.
See also history, nightmen.
I have seen a few that have amused me; for example in a university biochemistry department GOD IS ALIVE AND WELL AND WORKING ON A LESS AMBITIOUS PROJECT. And along the bottom of a partition between cubicles in the office loo BEWARE LIMBO DANCERS!
The habit of writing on the walls is far from new. On a loo wall in the city of Herculaneum, buried by ash from the eruption of Vesuvius in AD79, is written APOLLONIVS MEDICVS TITI IMP. HIC CACARIT BENE. In other words, "Apollonius, physician of Emperor Titus, had a good crap here."
A survey by the London Regional Passengers' Committee in the stations of the London Underground and British Rail found that 77% of men's cubicles were adorned with graffiti, and 79% of women's. An anonymous spokeswoman said "The answer is simple---we sit there longer, write faster, and have dirtier minds!"