Here, we show that in mice with a deletion in protein tyrosine phosphatase nonreceptor type 2 (PTPN2) in macrophages, infection with Citrobacter rodentium, a model of enteropathogenic and enterohemorrhagic E. coli infection in humans, promoted a strong type 1/IL-22–driven immune response, culminating in accelerated disease but also faster clearance of the pathogen. Here, IL22 is linked to infection.