晚上关于删除的日志文件主要有 https://blog.csdn.net/hellolib/article/details/78316253, 其实我这里的实现方式和他差不多,不过我这里不用配置时间, 直接写死 删除10天以前的日志数据,
static ILog _log = null;
static object lockHelper = new object();
private ILog GetLog()
{
if (null == _log)
{
lock (lockHelper)
{
if (null == _log)
{
StackTrace stackTrace = new StackTrace(this._skipFrames);
StackFrame stackFrame = stackTrace.GetFrame(0);
MethodBase methodBase = stackFrame.GetMethod();
// ApplicationRollingFile在.config文件中配置的名称
_log = LogManager.GetLogger("ApplicationRollingFile");
Task.Run(()=> {
var apps = _log.Logger.Repository.GetAppenders();