Tips & Tricks: Sitecore Log file naming

When I started working with Sitecore, I always wondered how Sitecore names its logs. Sometimes you would see a date only as the name e.g. log.20170214.txt and sometimes a date and a time e.g. log.20170214.165444.txt.

Keep in mind that Sitecore uses Log4Net as the logging framework so you’ll need to read more about it if you’re planning to customize it.

So I just wanted to share how Sitecore names the logs files:

  1. The first point to note is that Sitecore (with the default configuration) creates a new log file for each day with the day’s date only e.g. log.yyyyMMdd.txt
  2. It keeps appending log data into that folder until Sitecore can’t gain access to write into that file, for example when another process has locked that file
  3. At this point, Sitecore creates a new file with the same day’s date but includes the time of the latest log entry. Therefore, you would see the log file’s name is the same as the log’s first log entry e.g. log.yyyyMMddHHmmss.txt
  4. Then Sitecore would continue appending into that new log file until it can’t gain access to it, which then it repeats the previous step

If you ever need to edit its log naming patterns or to add size or age limits, read about Log4Net appenders and edit them. You can find them in Sitecore.config.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s