While working on the
logging configuration for sending messages via email last week, I realised that all the documentation I could find for the
So with a bit of research, I've dug out the important values that can be used in case anyone else needs to configure log messages in older versions of Sitecore:
%tThe operating system identifier for the thread raising the log message
%dThe date at which the log message was created. Can be modified by appending a format parameter in curly braces. The code describes the set as being IS08601, ABSOLUTE and DATE, however the old log4j documentation implies any valid date-type format string could be used here.
%pThe severity of the log message, when it was recorded.
%CReturns the fully qualified class name that raised the log message.
%LThe source code line number for the method. This does not seem to display a value for messages logged by Sitecore itself.
%WThe windows username of the process identity running the code which logged the message.
%aThe identifier set when the AppDomain was created by IIS.
%C, seems to return the fully qualified name of the class raising the log message.
%MThe name of the logging method that was called to record the message. %l returns the fully qualified method name, and %M just the name of the method called.
%mThe full text of the log message that was recorded.
%rRecords the time difference (in milliseconds) between the time the logging event begins and the time the log event record is complete.
%nWrites a line ending.
%X/ Nested Diagostic Context:
%xThese two patterns let you output custom data that has been recorded during the logging session. You specify what item from the internal log data collection you want by supplying its key in curly braces after the format specifier. e.g. "%X" These might be useful if you were writing your own custom log data, but as far as I can see from a bit of reflection-based investigation there's no data recorded here by default. There are some docs available for log4j which cover how this works.
If you need to output a
Logging patterns can also include a column width format, by placing a number between the
and the pattern character. For example
will ensure the field occupies at least four characters and align it to the right of the space. Use a negative number to align to the left:
Hopefully that'll be of help to someone other than me...↑ Back to top