Logging - the process of recording application actions and state to a secondary interface.
Second interface could be:
1:
|
|
1: 2: 3: 4: 5: 6: 7: 8: |
|
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: |
|
What information might be interesting for those who will read log?
Depending on application or environment we might be interesting to find logs in different places:
What might be important for those who read logs?
What if only subset of generated logs required for now? In this case filters might be applied
Applying filters and log levels log messages might be sent to different interfaces
[INFO] -> Datadase
[DEBUG] -> File
[ERROR, FATAL] -> EMail
Logs are useful but they might be excessive:
Threre are numerous of logging frameworks:
Core features:
Log4net has 4 main components:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: |
|
1: 2: 3: 4: 5: |
|
Log4net supports hierarchy of loggers
Hierarchy concepts uses C# namespaces
1: 2: 3: 4: 5: 6: 7: 8: 9: |
|
1: 2: 3: 4: |
|
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: |
|
Appenders specify where and how the information will be logged
1: 2: 3: 4: 5: 6: |
|
1: 2: 3: 4: 5: 6: |
|
More about configuration and filters
1: 2: 3: 4: |
|
More info about predefined layouts and configuration