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:
- 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
- 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
- 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
- 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.