I need to register this because my application user API is growing and requires tracking of possible errors and various states.
Using the log in a user application will result in a recursive error.
Is there any good / best practice for logging information / errors in a user application?
A semaphore lock with FIleStream and FileWriter looks fine, but it blocks resources and slows down the process if multiple processes are competing for an entry in the same log file.
Official source: http://logging.apache.org/log4net/release/faq.html
As suggested by stuartd, LogLog can be used for internal debugging.
First, 2 things must be installed in the project's .config file.
1)
<appSettings>
<add key="log4net.Internal.Debug" value="true"/>
</appSettings>
This allows log4net / j internal debugging.
2)
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add
name="textWriterTraceListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\tmp\log4net.txt" />
</listeners>
</trace>
</system.diagnostics>
This allows the Windows machine to track. 2 things to make sure.
a) the application folder should be there because it does not check for the existence of a folder for the log file. If the folder is missing, the file will not be created.
b) administrator rights to this program are not required, otherwise the file cannot be written.
3)
log4net.Util.LogLog.Debug(null, "testing internal debug");
In a custom application, just use this for internal logging. For input parameter {0}, I'm not sure why it requires it obj Type. I will find out why and what its purpose is.