As a young man he worked as a shepherd and farmhand and was largely self-educated through reading. He became widely known as the "Ettrick Shepherd", a nickname under which some of his works were published, and the character name he was given in the widely read series Noctes Ambrosianae, published in Blackwood's Magazine. He is best known today for his novel The Private Memoirs and Confessions of a Justified Sinner. In 1801 Hogg was recruited to collect ballads for Walter Scott's collection The Minstrelsy of the Scottish Border. He met Scott himself the following year and began working for the Edinburgh Magazine. In 1805–06 he worked as a shepherd, meeting the poet Allan Cunningham and becoming friends with him and his family. In October 1806 he became the lover of a young woman named Catherine Henderson. His first collection, The Mountain Bard, was published in February 1807 by Constable. At the end of summer 1807 his daughter by Catherine Henderson was born, baptised on 13 December as Catherine Hogg. He continued working as a sheep-grazer for other farmers, but his debts began to grow throughout 1808–1809. At the end of 1809 he began an affair with Elizabeth Beattie, and soon after absconded from his creditors, returning in disgrace to Ettrick. In 1810 he moved to Edinburgh to start a literary career. In March 1810 his daughter by Elizabeth Beattie was born, christened Elizabeth Hogg in June. At the end of 1810 he met his future wife Margaret Phillips. His magazine The Spy, begun in 1810, failed after a year. In 1814 he met William Wordsworth and made a visit to the Lake District to see Wordsworth and other poets. In 1815 the Duke of Buccleuch granted him a small farm at Eltrive Moss, where he could live rent-free for his lifetime. It was through the Edinburgh Monthly Magazine, soon renamed Blackwood's Magazine, that Hogg found fame, although it was not the sort that he wanted. Launched as a counterblast to the Whig Edinburgh Review, Blackwood wanted punchy content in his new publication. He found his ideal contributors in John Wilson (who wrote as Christopher North) and John Gibson Lockhart (later Walter Scott's son-in-law and biographer). Their first published article, "The Chaldee Manuscript", a thinly disguised satire of Edinburgh society in biblical language which Hogg started, and Wilson and Lockhart elaborated, was so controversial that Wilson fled and Blackwood was forced to apologise. Soon Blackwood's Tory views and reviews – often scurrilous attacks on other writers – were notorious, and the magazine, or "Maga" as it came to be known, had become one of the best-selling journals of its day. But Hogg quickly found himself forced out of the inner circle. As other writers such as Thomas de Quincey joined, he became not merely excluded from the lion's share of publication in Maga, but a figure of fun in its pages. Wilson and Lockhart were dangerous friends. In 1822 the Maga launched the Noctes Ambrosianae, imaginary conversations in a drinking-den between semi-fictional characters such as North, The Opium Eater and the Ettrick Shepherd. The Shepherd was Hogg. The Noctes continued until 1834, and were written after 1825 mostly by Wilson, although other writers, including Hogg himself, had a hand in them. The Shepherd of the Noctes is a part-animal, part-rural simpleton, and part-savant. He became one of the best-known figures in topical literary affairs, famous throughout Britain and its colonies. Quite what the real James Hogg made of this is mostly unknown, although some of his letters to Blackwood and others express outrage and anguish. In 1833 Hogg had an accident while curling, falling through the ice, causing a serious illness. In 1834 his biographical work Familiar Anecdotes of Sir Walter Scott was published in the United States, while a pirated version published in Edinburgh led to a break with Lockhart. Hogg mended his relationship with Blackwood in May, but Blackwood died at the end of the year.