With Log4net, you can configure the layout of the string that you want to log.
It's very simple, because you can change the pattern layout string in few seconds and without compiling the application.
You don't compile everytime change the pattern layout string, because it is in the application config.
For web application it is in the web.config file and for desktop application it is in the app.config.
Each pattern member starts with % and is followeb by the name of pattern member.
You can change the width, padding, left and right justification for each pattern member.
Sometimes, I use this layout pattern: %type %file %line %method %location %class %C %F %L %l %M %n , but below I explain every single member in order to you can create your pattern layout.
a or appdomain Friendly name of appdomain
c or logger Used to output the logger of the logging event
C or class or type The fully type name of the caller class
d or date The date of logging event in the local time zone
exception The exception
F or file The file name where the logging request was issued
identity or u The active user
l or location Location information of the caller
L or line The line number from where the logging request was issued
level or p The level of the logging event
m or message Application supplied message associated with the logging event
M or method The method name where the logging request was issued
n or newline Line separator
r or timestamp The timestamp when the logging request was issued
t or thread The name of thread that generated the logging event
username or w The Windows Identity for active user
Tha't all folks!!!