Quick Tip: Turn off verbose template logging in Tridion Event Log

As a good developer, you write out useful information and debug messages in your .NET TBBs using the built in templating logger. This is great when running the TBBs in the template builder to give a bit of extra info about the processing. However, by default info messages will be logged in the Tridion Event Log of your Publisher server, causing log bloat, and making it harder to see important Error and Warning messages. Its really easy to turn this off, but I am not sure I have seen it documented anywhere. Heres how…

Firstly, how do you log a message in templates? Its quite easy. In your .NET class which implements ITemplate, add something like this:

You will now see something like the following in the Template Builder when you run a template containing your TBB:

Template Builder

And if you publish, you will see corresponding messages in the Event Log:

Event Log

All very well and good, but on a production environment (or perhaps any environment) you do not want to bloat the log with every info message. So how to configure it so only warnings and errors are logged? It turns out to be quite easy, although not documented as far as I know:

  1. On your publisher server, open /bin/TcmPublisher.exe.config
  2. Find the loggingConfiguration/specialSources/allEvents element and change the switchValue from Information to Warning
  3. Save the file and restart the publisher service

More information on logging information can be found in the online docs (Login required):

One thought on “Quick Tip: Turn off verbose template logging in Tridion Event Log

  1. It’s a good tip, but also worth considering that a “good developer” puts sufficient thought into which logging level to use for his output. So for example, a Windows service typically logs to Info when it starts or shuts down. That’s sometimes handy, but if the developer has made the mistake of logging to info every time the service processes something, it’s probably going to bloat the logs. (Pretty irritating too!) So – stuff that happens once an hour, or a couple of times a day or week… info. If it happens more than that, it’s your code just doing its normal work, so if you need logging, it’s debug logging.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>